@wazir-dev/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +111 -0
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +101 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/assets/composition-engine.mmd +34 -0
- package/assets/demo-script.sh +17 -0
- package/assets/logo-dark.svg +14 -0
- package/assets/logo.svg +14 -0
- package/assets/pipeline.mmd +39 -0
- package/assets/record-demo.sh +51 -0
- package/docs/README.md +51 -0
- package/docs/adapters/context-mode.md +60 -0
- package/docs/concepts/architecture.md +87 -0
- package/docs/concepts/artifact-model.md +60 -0
- package/docs/concepts/composition-engine.md +36 -0
- package/docs/concepts/indexing-and-recall.md +160 -0
- package/docs/concepts/observability.md +41 -0
- package/docs/concepts/roles-and-workflows.md +59 -0
- package/docs/concepts/terminology-policy.md +27 -0
- package/docs/getting-started/01-installation.md +78 -0
- package/docs/getting-started/02-first-run.md +102 -0
- package/docs/getting-started/03-adding-to-project.md +15 -0
- package/docs/getting-started/04-host-setup.md +15 -0
- package/docs/guides/ci-integration.md +15 -0
- package/docs/guides/creating-skills.md +15 -0
- package/docs/guides/expertise-module-authoring.md +15 -0
- package/docs/guides/hook-development.md +15 -0
- package/docs/guides/memory-and-learnings.md +34 -0
- package/docs/guides/multi-host-export.md +15 -0
- package/docs/guides/troubleshooting.md +101 -0
- package/docs/guides/writing-custom-roles.md +15 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
- package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
- package/docs/readmes/INDEX.md +99 -0
- package/docs/readmes/features/expertise/README.md +171 -0
- package/docs/readmes/features/exports/README.md +222 -0
- package/docs/readmes/features/hooks/README.md +103 -0
- package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
- package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
- package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
- package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
- package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
- package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
- package/docs/readmes/features/hooks/session-start.md +119 -0
- package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
- package/docs/readmes/features/roles/README.md +157 -0
- package/docs/readmes/features/roles/clarifier.md +152 -0
- package/docs/readmes/features/roles/content-author.md +190 -0
- package/docs/readmes/features/roles/designer.md +193 -0
- package/docs/readmes/features/roles/executor.md +184 -0
- package/docs/readmes/features/roles/learner.md +210 -0
- package/docs/readmes/features/roles/planner.md +182 -0
- package/docs/readmes/features/roles/researcher.md +164 -0
- package/docs/readmes/features/roles/reviewer.md +184 -0
- package/docs/readmes/features/roles/specifier.md +162 -0
- package/docs/readmes/features/roles/verifier.md +215 -0
- package/docs/readmes/features/schemas/README.md +178 -0
- package/docs/readmes/features/skills/README.md +63 -0
- package/docs/readmes/features/skills/brainstorming.md +96 -0
- package/docs/readmes/features/skills/debugging.md +148 -0
- package/docs/readmes/features/skills/design.md +120 -0
- package/docs/readmes/features/skills/prepare-next.md +109 -0
- package/docs/readmes/features/skills/run-audit.md +159 -0
- package/docs/readmes/features/skills/scan-project.md +109 -0
- package/docs/readmes/features/skills/self-audit.md +176 -0
- package/docs/readmes/features/skills/tdd.md +137 -0
- package/docs/readmes/features/skills/using-skills.md +92 -0
- package/docs/readmes/features/skills/verification.md +120 -0
- package/docs/readmes/features/skills/writing-plans.md +104 -0
- package/docs/readmes/features/tooling/README.md +320 -0
- package/docs/readmes/features/workflows/README.md +186 -0
- package/docs/readmes/features/workflows/author.md +181 -0
- package/docs/readmes/features/workflows/clarify.md +154 -0
- package/docs/readmes/features/workflows/design-review.md +171 -0
- package/docs/readmes/features/workflows/design.md +169 -0
- package/docs/readmes/features/workflows/discover.md +162 -0
- package/docs/readmes/features/workflows/execute.md +173 -0
- package/docs/readmes/features/workflows/learn.md +167 -0
- package/docs/readmes/features/workflows/plan-review.md +165 -0
- package/docs/readmes/features/workflows/plan.md +170 -0
- package/docs/readmes/features/workflows/prepare-next.md +167 -0
- package/docs/readmes/features/workflows/review.md +169 -0
- package/docs/readmes/features/workflows/run-audit.md +191 -0
- package/docs/readmes/features/workflows/spec-challenge.md +159 -0
- package/docs/readmes/features/workflows/specify.md +160 -0
- package/docs/readmes/features/workflows/verify.md +177 -0
- package/docs/readmes/packages/README.md +50 -0
- package/docs/readmes/packages/ajv.md +117 -0
- package/docs/readmes/packages/context-mode.md +118 -0
- package/docs/readmes/packages/gray-matter.md +116 -0
- package/docs/readmes/packages/node-test.md +137 -0
- package/docs/readmes/packages/yaml.md +112 -0
- package/docs/reference/configuration-reference.md +159 -0
- package/docs/reference/expertise-index.md +52 -0
- package/docs/reference/git-flow.md +43 -0
- package/docs/reference/hooks.md +87 -0
- package/docs/reference/host-exports.md +50 -0
- package/docs/reference/launch-checklist.md +172 -0
- package/docs/reference/marketplace-listings.md +76 -0
- package/docs/reference/release-process.md +34 -0
- package/docs/reference/roles-reference.md +77 -0
- package/docs/reference/skills.md +33 -0
- package/docs/reference/templates.md +29 -0
- package/docs/reference/tooling-cli.md +94 -0
- package/docs/truth-claims.yaml +222 -0
- package/expertise/PROGRESS.md +63 -0
- package/expertise/README.md +18 -0
- package/expertise/antipatterns/PROGRESS.md +56 -0
- package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
- package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
- package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
- package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
- package/expertise/antipatterns/backend/index.md +24 -0
- package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
- package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
- package/expertise/antipatterns/code/async-antipatterns.md +622 -0
- package/expertise/antipatterns/code/code-smells.md +1186 -0
- package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
- package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
- package/expertise/antipatterns/code/index.md +27 -0
- package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
- package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
- package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
- package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
- package/expertise/antipatterns/design/dark-patterns.md +1121 -0
- package/expertise/antipatterns/design/index.md +22 -0
- package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
- package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
- package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
- package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
- package/expertise/antipatterns/frontend/index.md +23 -0
- package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
- package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
- package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
- package/expertise/antipatterns/index.md +31 -0
- package/expertise/antipatterns/performance/index.md +20 -0
- package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
- package/expertise/antipatterns/performance/premature-optimization.md +623 -0
- package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
- package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
- package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
- package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
- package/expertise/antipatterns/process/index.md +23 -0
- package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
- package/expertise/antipatterns/security/index.md +20 -0
- package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
- package/expertise/antipatterns/security/security-theater.md +843 -0
- package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
- package/expertise/architecture/PROGRESS.md +70 -0
- package/expertise/architecture/data/caching-architecture.md +671 -0
- package/expertise/architecture/data/data-consistency.md +574 -0
- package/expertise/architecture/data/data-modeling.md +536 -0
- package/expertise/architecture/data/event-streams-and-queues.md +634 -0
- package/expertise/architecture/data/index.md +25 -0
- package/expertise/architecture/data/search-architecture.md +663 -0
- package/expertise/architecture/data/sql-vs-nosql.md +708 -0
- package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
- package/expertise/architecture/decisions/build-vs-buy.md +616 -0
- package/expertise/architecture/decisions/index.md +23 -0
- package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
- package/expertise/architecture/decisions/technology-selection.md +616 -0
- package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
- package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
- package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
- package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
- package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
- package/expertise/architecture/distributed/index.md +25 -0
- package/expertise/architecture/distributed/saga-pattern.md +797 -0
- package/expertise/architecture/foundations/architectural-thinking.md +460 -0
- package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
- package/expertise/architecture/foundations/design-principles-solid.md +649 -0
- package/expertise/architecture/foundations/domain-driven-design.md +719 -0
- package/expertise/architecture/foundations/index.md +25 -0
- package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
- package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
- package/expertise/architecture/index.md +34 -0
- package/expertise/architecture/integration/api-design-graphql.md +638 -0
- package/expertise/architecture/integration/api-design-grpc.md +804 -0
- package/expertise/architecture/integration/api-design-rest.md +892 -0
- package/expertise/architecture/integration/index.md +25 -0
- package/expertise/architecture/integration/third-party-integration.md +795 -0
- package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
- package/expertise/architecture/integration/websockets-realtime.md +791 -0
- package/expertise/architecture/mobile-architecture/index.md +22 -0
- package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
- package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
- package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
- package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
- package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
- package/expertise/architecture/patterns/event-driven.md +797 -0
- package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
- package/expertise/architecture/patterns/index.md +27 -0
- package/expertise/architecture/patterns/layered-architecture.md +736 -0
- package/expertise/architecture/patterns/microservices.md +753 -0
- package/expertise/architecture/patterns/modular-monolith.md +692 -0
- package/expertise/architecture/patterns/monolith.md +626 -0
- package/expertise/architecture/patterns/plugin-architecture.md +735 -0
- package/expertise/architecture/patterns/serverless.md +780 -0
- package/expertise/architecture/scaling/database-scaling.md +615 -0
- package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
- package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
- package/expertise/architecture/scaling/index.md +24 -0
- package/expertise/architecture/scaling/multi-tenancy.md +800 -0
- package/expertise/architecture/scaling/stateless-design.md +787 -0
- package/expertise/backend/embedded-firmware.md +625 -0
- package/expertise/backend/go.md +853 -0
- package/expertise/backend/index.md +24 -0
- package/expertise/backend/java-spring.md +448 -0
- package/expertise/backend/node-typescript.md +625 -0
- package/expertise/backend/python-fastapi.md +724 -0
- package/expertise/backend/rust.md +458 -0
- package/expertise/backend/solidity.md +711 -0
- package/expertise/composition-map.yaml +443 -0
- package/expertise/content/foundations/content-modeling.md +395 -0
- package/expertise/content/foundations/editorial-standards.md +449 -0
- package/expertise/content/foundations/index.md +24 -0
- package/expertise/content/foundations/microcopy.md +455 -0
- package/expertise/content/foundations/terminology-governance.md +509 -0
- package/expertise/content/index.md +34 -0
- package/expertise/content/patterns/accessibility-copy.md +518 -0
- package/expertise/content/patterns/index.md +24 -0
- package/expertise/content/patterns/notification-content.md +433 -0
- package/expertise/content/patterns/sample-content.md +486 -0
- package/expertise/content/patterns/state-copy.md +439 -0
- package/expertise/design/PROGRESS.md +58 -0
- package/expertise/design/disciplines/dark-mode-theming.md +577 -0
- package/expertise/design/disciplines/design-systems.md +595 -0
- package/expertise/design/disciplines/index.md +25 -0
- package/expertise/design/disciplines/information-architecture.md +800 -0
- package/expertise/design/disciplines/interaction-design.md +788 -0
- package/expertise/design/disciplines/responsive-design.md +552 -0
- package/expertise/design/disciplines/usability-testing.md +516 -0
- package/expertise/design/disciplines/user-research.md +792 -0
- package/expertise/design/foundations/accessibility-design.md +796 -0
- package/expertise/design/foundations/color-theory.md +797 -0
- package/expertise/design/foundations/iconography.md +795 -0
- package/expertise/design/foundations/index.md +26 -0
- package/expertise/design/foundations/motion-and-animation.md +653 -0
- package/expertise/design/foundations/rtl-design.md +585 -0
- package/expertise/design/foundations/spacing-and-layout.md +607 -0
- package/expertise/design/foundations/typography.md +800 -0
- package/expertise/design/foundations/visual-hierarchy.md +761 -0
- package/expertise/design/index.md +32 -0
- package/expertise/design/patterns/authentication-flows.md +474 -0
- package/expertise/design/patterns/content-consumption.md +789 -0
- package/expertise/design/patterns/data-display.md +618 -0
- package/expertise/design/patterns/e-commerce.md +1494 -0
- package/expertise/design/patterns/feedback-and-states.md +642 -0
- package/expertise/design/patterns/forms-and-input.md +819 -0
- package/expertise/design/patterns/gamification.md +801 -0
- package/expertise/design/patterns/index.md +31 -0
- package/expertise/design/patterns/microinteractions.md +449 -0
- package/expertise/design/patterns/navigation.md +800 -0
- package/expertise/design/patterns/notifications.md +705 -0
- package/expertise/design/patterns/onboarding.md +700 -0
- package/expertise/design/patterns/search-and-filter.md +601 -0
- package/expertise/design/patterns/settings-and-preferences.md +768 -0
- package/expertise/design/patterns/social-and-community.md +748 -0
- package/expertise/design/platforms/desktop-native.md +612 -0
- package/expertise/design/platforms/index.md +25 -0
- package/expertise/design/platforms/mobile-android.md +825 -0
- package/expertise/design/platforms/mobile-cross-platform.md +983 -0
- package/expertise/design/platforms/mobile-ios.md +699 -0
- package/expertise/design/platforms/tablet.md +794 -0
- package/expertise/design/platforms/web-dashboard.md +790 -0
- package/expertise/design/platforms/web-responsive.md +550 -0
- package/expertise/design/psychology/behavioral-nudges.md +449 -0
- package/expertise/design/psychology/cognitive-load.md +1191 -0
- package/expertise/design/psychology/error-psychology.md +778 -0
- package/expertise/design/psychology/index.md +22 -0
- package/expertise/design/psychology/persuasive-design.md +736 -0
- package/expertise/design/psychology/user-mental-models.md +623 -0
- package/expertise/design/tooling/open-pencil.md +266 -0
- package/expertise/frontend/angular.md +1073 -0
- package/expertise/frontend/desktop-electron.md +546 -0
- package/expertise/frontend/flutter.md +782 -0
- package/expertise/frontend/index.md +27 -0
- package/expertise/frontend/native-android.md +409 -0
- package/expertise/frontend/native-ios.md +490 -0
- package/expertise/frontend/react-native.md +1160 -0
- package/expertise/frontend/react.md +808 -0
- package/expertise/frontend/vue.md +1089 -0
- package/expertise/humanize/domain-rules-code.md +79 -0
- package/expertise/humanize/domain-rules-content.md +67 -0
- package/expertise/humanize/domain-rules-technical-docs.md +56 -0
- package/expertise/humanize/index.md +35 -0
- package/expertise/humanize/self-audit-checklist.md +87 -0
- package/expertise/humanize/sentence-patterns.md +218 -0
- package/expertise/humanize/vocabulary-blacklist.md +105 -0
- package/expertise/i18n/PROGRESS.md +65 -0
- package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
- package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
- package/expertise/i18n/advanced/complex-scripts.md +30 -0
- package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
- package/expertise/i18n/advanced/testing-i18n.md +28 -0
- package/expertise/i18n/content/content-adaptation.md +23 -0
- package/expertise/i18n/content/locale-specific-formatting.md +23 -0
- package/expertise/i18n/content/machine-translation-integration.md +28 -0
- package/expertise/i18n/content/translation-management.md +29 -0
- package/expertise/i18n/foundations/date-time-calendars.md +67 -0
- package/expertise/i18n/foundations/i18n-architecture.md +272 -0
- package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
- package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
- package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
- package/expertise/i18n/foundations/string-externalization.md +236 -0
- package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
- package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
- package/expertise/i18n/index.md +38 -0
- package/expertise/i18n/platform/backend-i18n.md +31 -0
- package/expertise/i18n/platform/flutter-i18n.md +148 -0
- package/expertise/i18n/platform/native-android-i18n.md +36 -0
- package/expertise/i18n/platform/native-ios-i18n.md +36 -0
- package/expertise/i18n/platform/react-i18n.md +103 -0
- package/expertise/i18n/platform/web-css-i18n.md +81 -0
- package/expertise/i18n/rtl/arabic-specific.md +175 -0
- package/expertise/i18n/rtl/hebrew-specific.md +149 -0
- package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
- package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
- package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
- package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
- package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
- package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
- package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
- package/expertise/i18n/rtl/rtl-typography.md +160 -0
- package/expertise/index.md +113 -0
- package/expertise/index.yaml +216 -0
- package/expertise/infrastructure/cloud-aws.md +597 -0
- package/expertise/infrastructure/cloud-gcp.md +599 -0
- package/expertise/infrastructure/cybersecurity.md +816 -0
- package/expertise/infrastructure/database-mongodb.md +447 -0
- package/expertise/infrastructure/database-postgres.md +400 -0
- package/expertise/infrastructure/devops-cicd.md +787 -0
- package/expertise/infrastructure/index.md +27 -0
- package/expertise/performance/PROGRESS.md +50 -0
- package/expertise/performance/backend/api-latency.md +1204 -0
- package/expertise/performance/backend/background-jobs.md +506 -0
- package/expertise/performance/backend/connection-pooling.md +1209 -0
- package/expertise/performance/backend/database-query-optimization.md +515 -0
- package/expertise/performance/backend/index.md +23 -0
- package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
- package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
- package/expertise/performance/foundations/caching-strategies.md +489 -0
- package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
- package/expertise/performance/foundations/index.md +24 -0
- package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
- package/expertise/performance/foundations/memory-management.md +964 -0
- package/expertise/performance/foundations/performance-budgets.md +1314 -0
- package/expertise/performance/index.md +31 -0
- package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
- package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
- package/expertise/performance/infrastructure/index.md +22 -0
- package/expertise/performance/infrastructure/load-balancing.md +1081 -0
- package/expertise/performance/infrastructure/observability.md +1079 -0
- package/expertise/performance/mobile/index.md +23 -0
- package/expertise/performance/mobile/mobile-animations.md +544 -0
- package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
- package/expertise/performance/mobile/mobile-network.md +452 -0
- package/expertise/performance/mobile/mobile-rendering.md +599 -0
- package/expertise/performance/mobile/mobile-startup-time.md +505 -0
- package/expertise/performance/platform-specific/flutter-performance.md +647 -0
- package/expertise/performance/platform-specific/index.md +22 -0
- package/expertise/performance/platform-specific/node-performance.md +1307 -0
- package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
- package/expertise/performance/platform-specific/react-performance.md +1403 -0
- package/expertise/performance/web/bundle-optimization.md +1239 -0
- package/expertise/performance/web/image-and-media.md +636 -0
- package/expertise/performance/web/index.md +24 -0
- package/expertise/performance/web/network-optimization.md +1133 -0
- package/expertise/performance/web/rendering-performance.md +1098 -0
- package/expertise/performance/web/ssr-and-hydration.md +918 -0
- package/expertise/performance/web/web-vitals.md +1374 -0
- package/expertise/quality/accessibility.md +985 -0
- package/expertise/quality/evidence-based-verification.md +499 -0
- package/expertise/quality/index.md +24 -0
- package/expertise/quality/ml-model-audit.md +614 -0
- package/expertise/quality/performance.md +600 -0
- package/expertise/quality/testing-api.md +891 -0
- package/expertise/quality/testing-mobile.md +496 -0
- package/expertise/quality/testing-web.md +849 -0
- package/expertise/security/PROGRESS.md +54 -0
- package/expertise/security/agentic-identity.md +540 -0
- package/expertise/security/compliance-frameworks.md +601 -0
- package/expertise/security/data/data-encryption.md +364 -0
- package/expertise/security/data/data-privacy-gdpr.md +692 -0
- package/expertise/security/data/database-security.md +1171 -0
- package/expertise/security/data/index.md +22 -0
- package/expertise/security/data/pii-handling.md +531 -0
- package/expertise/security/foundations/authentication.md +1041 -0
- package/expertise/security/foundations/authorization.md +603 -0
- package/expertise/security/foundations/cryptography.md +1001 -0
- package/expertise/security/foundations/index.md +25 -0
- package/expertise/security/foundations/owasp-top-10.md +1354 -0
- package/expertise/security/foundations/secrets-management.md +1217 -0
- package/expertise/security/foundations/secure-sdlc.md +700 -0
- package/expertise/security/foundations/supply-chain-security.md +698 -0
- package/expertise/security/index.md +31 -0
- package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
- package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
- package/expertise/security/infrastructure/container-security.md +721 -0
- package/expertise/security/infrastructure/incident-response.md +1295 -0
- package/expertise/security/infrastructure/index.md +24 -0
- package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
- package/expertise/security/infrastructure/network-security.md +1337 -0
- package/expertise/security/mobile/index.md +23 -0
- package/expertise/security/mobile/mobile-android-security.md +1218 -0
- package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
- package/expertise/security/mobile/mobile-data-storage.md +1265 -0
- package/expertise/security/mobile/mobile-ios-security.md +1401 -0
- package/expertise/security/mobile/mobile-network-security.md +1520 -0
- package/expertise/security/smart-contract-security.md +594 -0
- package/expertise/security/testing/index.md +22 -0
- package/expertise/security/testing/penetration-testing.md +1258 -0
- package/expertise/security/testing/security-code-review.md +1765 -0
- package/expertise/security/testing/threat-modeling.md +1074 -0
- package/expertise/security/testing/vulnerability-scanning.md +1062 -0
- package/expertise/security/web/api-security.md +586 -0
- package/expertise/security/web/cors-and-headers.md +433 -0
- package/expertise/security/web/csrf.md +562 -0
- package/expertise/security/web/file-upload.md +1477 -0
- package/expertise/security/web/index.md +25 -0
- package/expertise/security/web/injection.md +1375 -0
- package/expertise/security/web/session-management.md +1101 -0
- package/expertise/security/web/xss.md +1158 -0
- package/exports/README.md +17 -0
- package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
- package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
- package/exports/hosts/claude/.claude/agents/designer.md +55 -0
- package/exports/hosts/claude/.claude/agents/executor.md +55 -0
- package/exports/hosts/claude/.claude/agents/learner.md +51 -0
- package/exports/hosts/claude/.claude/agents/planner.md +53 -0
- package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
- package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
- package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
- package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
- package/exports/hosts/claude/.claude/commands/author.md +42 -0
- package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
- package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
- package/exports/hosts/claude/.claude/commands/design.md +44 -0
- package/exports/hosts/claude/.claude/commands/discover.md +37 -0
- package/exports/hosts/claude/.claude/commands/execute.md +48 -0
- package/exports/hosts/claude/.claude/commands/learn.md +38 -0
- package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
- package/exports/hosts/claude/.claude/commands/plan.md +39 -0
- package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
- package/exports/hosts/claude/.claude/commands/review.md +40 -0
- package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
- package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
- package/exports/hosts/claude/.claude/commands/specify.md +38 -0
- package/exports/hosts/claude/.claude/commands/verify.md +37 -0
- package/exports/hosts/claude/.claude/settings.json +34 -0
- package/exports/hosts/claude/CLAUDE.md +19 -0
- package/exports/hosts/claude/export.manifest.json +38 -0
- package/exports/hosts/claude/host-package.json +67 -0
- package/exports/hosts/codex/AGENTS.md +19 -0
- package/exports/hosts/codex/export.manifest.json +38 -0
- package/exports/hosts/codex/host-package.json +41 -0
- package/exports/hosts/cursor/.cursor/hooks.json +16 -0
- package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
- package/exports/hosts/cursor/export.manifest.json +38 -0
- package/exports/hosts/cursor/host-package.json +42 -0
- package/exports/hosts/gemini/GEMINI.md +19 -0
- package/exports/hosts/gemini/export.manifest.json +38 -0
- package/exports/hosts/gemini/host-package.json +41 -0
- package/hooks/README.md +18 -0
- package/hooks/definitions/loop_cap_guard.yaml +21 -0
- package/hooks/definitions/post_tool_capture.yaml +24 -0
- package/hooks/definitions/pre_compact_summary.yaml +19 -0
- package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
- package/hooks/definitions/protected_path_write_guard.yaml +19 -0
- package/hooks/definitions/session_start.yaml +19 -0
- package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
- package/hooks/loop-cap-guard +17 -0
- package/hooks/post-tool-lint +36 -0
- package/hooks/protected-path-write-guard +17 -0
- package/hooks/session-start +41 -0
- package/llms-full.txt +2355 -0
- package/llms.txt +43 -0
- package/package.json +79 -0
- package/roles/README.md +20 -0
- package/roles/clarifier.md +42 -0
- package/roles/content-author.md +63 -0
- package/roles/designer.md +55 -0
- package/roles/executor.md +55 -0
- package/roles/learner.md +51 -0
- package/roles/planner.md +53 -0
- package/roles/researcher.md +43 -0
- package/roles/reviewer.md +54 -0
- package/roles/specifier.md +47 -0
- package/roles/verifier.md +71 -0
- package/schemas/README.md +24 -0
- package/schemas/accepted-learning.schema.json +20 -0
- package/schemas/author-artifact.schema.json +156 -0
- package/schemas/clarification.schema.json +19 -0
- package/schemas/design-artifact.schema.json +80 -0
- package/schemas/docs-claim.schema.json +18 -0
- package/schemas/export-manifest.schema.json +20 -0
- package/schemas/hook.schema.json +67 -0
- package/schemas/host-export-package.schema.json +18 -0
- package/schemas/implementation-plan.schema.json +19 -0
- package/schemas/proposed-learning.schema.json +19 -0
- package/schemas/research.schema.json +18 -0
- package/schemas/review.schema.json +29 -0
- package/schemas/run-manifest.schema.json +18 -0
- package/schemas/spec-challenge.schema.json +18 -0
- package/schemas/spec.schema.json +20 -0
- package/schemas/usage.schema.json +102 -0
- package/schemas/verification-proof.schema.json +29 -0
- package/schemas/wazir-manifest.schema.json +173 -0
- package/skills/README.md +40 -0
- package/skills/brainstorming/SKILL.md +77 -0
- package/skills/debugging/SKILL.md +50 -0
- package/skills/design/SKILL.md +61 -0
- package/skills/dispatching-parallel-agents/SKILL.md +128 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +169 -0
- package/skills/humanize/SKILL.md +123 -0
- package/skills/init-pipeline/SKILL.md +124 -0
- package/skills/prepare-next/SKILL.md +20 -0
- package/skills/receiving-code-review/SKILL.md +123 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +108 -0
- package/skills/run-audit/SKILL.md +197 -0
- package/skills/scan-project/SKILL.md +41 -0
- package/skills/self-audit/SKILL.md +153 -0
- package/skills/subagent-driven-development/SKILL.md +154 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +102 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tdd/SKILL.md +23 -0
- package/skills/using-git-worktrees/SKILL.md +163 -0
- package/skills/using-skills/SKILL.md +95 -0
- package/skills/verification/SKILL.md +22 -0
- package/skills/wazir/SKILL.md +463 -0
- package/skills/writing-plans/SKILL.md +30 -0
- package/skills/writing-skills/SKILL.md +157 -0
- package/skills/writing-skills/anthropic-best-practices.md +122 -0
- package/skills/writing-skills/persuasion-principles.md +50 -0
- package/templates/README.md +20 -0
- package/templates/artifacts/README.md +10 -0
- package/templates/artifacts/accepted-learning.md +19 -0
- package/templates/artifacts/accepted-learning.template.json +12 -0
- package/templates/artifacts/author.md +74 -0
- package/templates/artifacts/author.template.json +19 -0
- package/templates/artifacts/clarification.md +21 -0
- package/templates/artifacts/clarification.template.json +12 -0
- package/templates/artifacts/execute-notes.md +19 -0
- package/templates/artifacts/implementation-plan.md +21 -0
- package/templates/artifacts/implementation-plan.template.json +11 -0
- package/templates/artifacts/learning-proposal.md +19 -0
- package/templates/artifacts/next-run-handoff.md +21 -0
- package/templates/artifacts/plan-review.md +19 -0
- package/templates/artifacts/proposed-learning.template.json +12 -0
- package/templates/artifacts/research.md +21 -0
- package/templates/artifacts/research.template.json +12 -0
- package/templates/artifacts/review-findings.md +19 -0
- package/templates/artifacts/review.template.json +11 -0
- package/templates/artifacts/run-manifest.template.json +8 -0
- package/templates/artifacts/spec-challenge.md +19 -0
- package/templates/artifacts/spec-challenge.template.json +11 -0
- package/templates/artifacts/spec.md +21 -0
- package/templates/artifacts/spec.template.json +12 -0
- package/templates/artifacts/verification-proof.md +19 -0
- package/templates/artifacts/verification-proof.template.json +11 -0
- package/templates/examples/accepted-learning.example.json +14 -0
- package/templates/examples/author.example.json +152 -0
- package/templates/examples/clarification.example.json +15 -0
- package/templates/examples/docs-claim.example.json +8 -0
- package/templates/examples/export-manifest.example.json +7 -0
- package/templates/examples/host-export-package.example.json +11 -0
- package/templates/examples/implementation-plan.example.json +17 -0
- package/templates/examples/proposed-learning.example.json +13 -0
- package/templates/examples/research.example.json +15 -0
- package/templates/examples/research.example.md +6 -0
- package/templates/examples/review.example.json +17 -0
- package/templates/examples/run-manifest.example.json +9 -0
- package/templates/examples/spec-challenge.example.json +14 -0
- package/templates/examples/spec.example.json +21 -0
- package/templates/examples/verification-proof.example.json +21 -0
- package/templates/examples/wazir-manifest.example.yaml +65 -0
- package/templates/task-definition-schema.md +99 -0
- package/tooling/README.md +20 -0
- package/tooling/src/adapters/context-mode.js +50 -0
- package/tooling/src/capture/command.js +376 -0
- package/tooling/src/capture/store.js +99 -0
- package/tooling/src/capture/usage.js +270 -0
- package/tooling/src/checks/branches.js +50 -0
- package/tooling/src/checks/brand-truth.js +110 -0
- package/tooling/src/checks/changelog.js +231 -0
- package/tooling/src/checks/command-registry.js +36 -0
- package/tooling/src/checks/commits.js +102 -0
- package/tooling/src/checks/docs-drift.js +103 -0
- package/tooling/src/checks/docs-truth.js +201 -0
- package/tooling/src/checks/runtime-surface.js +156 -0
- package/tooling/src/cli.js +116 -0
- package/tooling/src/command-options.js +56 -0
- package/tooling/src/commands/validate.js +320 -0
- package/tooling/src/doctor/command.js +91 -0
- package/tooling/src/export/command.js +77 -0
- package/tooling/src/export/compiler.js +498 -0
- package/tooling/src/guards/loop-cap-guard.js +52 -0
- package/tooling/src/guards/protected-path-write-guard.js +67 -0
- package/tooling/src/index/command.js +152 -0
- package/tooling/src/index/storage.js +1061 -0
- package/tooling/src/index/summarizers.js +261 -0
- package/tooling/src/loaders.js +18 -0
- package/tooling/src/project-root.js +22 -0
- package/tooling/src/recall/command.js +225 -0
- package/tooling/src/schema-validator.js +30 -0
- package/tooling/src/state-root.js +40 -0
- package/tooling/src/status/command.js +71 -0
- package/wazir.manifest.yaml +135 -0
- package/workflows/README.md +19 -0
- package/workflows/author.md +42 -0
- package/workflows/clarify.md +38 -0
- package/workflows/design-review.md +46 -0
- package/workflows/design.md +44 -0
- package/workflows/discover.md +37 -0
- package/workflows/execute.md +48 -0
- package/workflows/learn.md +38 -0
- package/workflows/plan-review.md +42 -0
- package/workflows/plan.md +39 -0
- package/workflows/prepare-next.md +37 -0
- package/workflows/review.md +40 -0
- package/workflows/run-audit.md +41 -0
- package/workflows/spec-challenge.md +41 -0
- package/workflows/specify.md +38 -0
- package/workflows/verify.md +37 -0
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
# AWS Cloud Security — Security Expertise Module
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Comprehensive reference for AI agents to secure AWS deployments through
|
|
4
|
+
> defense-in-depth, least privilege, encryption by default, and continuous monitoring.
|
|
5
|
+
>
|
|
6
|
+
> **Last updated:** 2026-03-08
|
|
7
|
+
> **Sources:** AWS Well-Architected Security Pillar, CIS AWS Foundations Benchmark v5.0,
|
|
8
|
+
> AWS Security Blog, Krebs on Security, The Hacker News, Qualys Threat Research, Datadog
|
|
9
|
+
> State of Cloud Security 2024, Fortinet Global Threat Landscape 2025, NIST SP 800-53,
|
|
10
|
+
> PCI-DSS v4.0.1, vendor documentation, published breach analyses.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Threat Landscape
|
|
15
|
+
|
|
16
|
+
### 1.1 Scale of the Problem
|
|
17
|
+
|
|
18
|
+
Cloud misconfiguration remains the dominant root cause of AWS security incidents.
|
|
19
|
+
The numbers paint a clear picture:
|
|
20
|
+
|
|
21
|
+
- **63% of AWS security incidents** in 2024 stemmed from misconfigurations, not
|
|
22
|
+
sophisticated attacks (Palo Alto Networks Unit 42).
|
|
23
|
+
- **1.48% of S3 buckets** remain effectively public despite years of AWS defaults
|
|
24
|
+
tightening (Datadog State of Cloud Security 2024).
|
|
25
|
+
- **93% of EC2 instances** still do not enforce IMDSv2, leaving them vulnerable to
|
|
26
|
+
SSRF-based credential theft (Qualys, 2024).
|
|
27
|
+
- **158 million AWS secret key records** were exposed on a single public server in a
|
|
28
|
+
2025 ransomware campaign targeting S3 buckets.
|
|
29
|
+
- **39 million secrets** leaked across GitHub in 2024, including AWS access keys,
|
|
30
|
+
database connection strings, and API tokens (GitHub Security).
|
|
31
|
+
|
|
32
|
+
### 1.2 Common Attack Vectors
|
|
33
|
+
|
|
34
|
+
| Attack Vector | Description |
|
|
35
|
+
|---------------------------------|-----------------------------------------------------------------|
|
|
36
|
+
| S3 bucket exposure | Public ACLs or bucket policies exposing sensitive data |
|
|
37
|
+
| IAM over-permissioning | Wildcard policies granting far more access than needed |
|
|
38
|
+
| Credential leakage | AWS keys hardcoded in source code, `.env` files, Docker images |
|
|
39
|
+
| SSRF to metadata service | Exploiting IMDSv1 to steal IAM role credentials via 169.254.169.254 |
|
|
40
|
+
| Misconfigured security groups | Inbound 0.0.0.0/0 on SSH (22), RDP (3389), or database ports |
|
|
41
|
+
| Unencrypted data stores | EBS volumes, RDS instances, S3 objects without encryption |
|
|
42
|
+
| Root account usage | Operating with root credentials instead of federated IAM roles |
|
|
43
|
+
| Missing CloudTrail logging | No audit trail for API calls, preventing forensic investigation |
|
|
44
|
+
| Lambda function URL exposure | Functions with AuthType NONE accessible to the public internet |
|
|
45
|
+
| Cross-account trust abuse | Overly permissive assume-role trust policies |
|
|
46
|
+
|
|
47
|
+
### 1.3 Real-World Breaches
|
|
48
|
+
|
|
49
|
+
**Capital One (2019) — SSRF + Over-Permissioned IAM Role — 106 Million Records**
|
|
50
|
+
|
|
51
|
+
On March 22-23, 2019, a former AWS employee exploited a Server-Side Request Forgery
|
|
52
|
+
(SSRF) vulnerability in Capital One's Web Application Firewall (WAF). The attack chain:
|
|
53
|
+
|
|
54
|
+
1. Identified a misconfigured WAF that allowed arbitrary HTTP requests from the server.
|
|
55
|
+
2. Used SSRF to query the EC2 Instance Metadata Service (IMDSv1) at
|
|
56
|
+
`http://169.254.169.254/latest/meta-data/iam/security-credentials/`.
|
|
57
|
+
3. Retrieved temporary AWS credentials from the IAM role attached to the EC2 instance.
|
|
58
|
+
4. The IAM role had excessive permissions — it could list and read over 700 S3 buckets.
|
|
59
|
+
5. Exfiltrated ~30GB of data: 106 million customer records, 140,000 Social Security
|
|
60
|
+
numbers, and 80,000 linked bank account numbers.
|
|
61
|
+
|
|
62
|
+
Root causes: (a) IMDSv1 responded to unauthenticated HTTP GET requests, (b) the IAM
|
|
63
|
+
role violated least privilege with broad S3 read access, (c) WAF misconfiguration
|
|
64
|
+
enabled the initial SSRF. Capital One was fined $80 million by the OCC. This breach
|
|
65
|
+
directly motivated AWS to develop and promote IMDSv2.
|
|
66
|
+
|
|
67
|
+
**Twitch (2021) — Server Misconfiguration — 125GB Source Code Leak**
|
|
68
|
+
|
|
69
|
+
On October 6, 2021, an anonymous poster on 4chan leaked 125GB of Twitch data (200GB
|
|
70
|
+
unzipped) due to a server configuration error. The exposed data included:
|
|
71
|
+
|
|
72
|
+
- 6,000 internal Git repositories and 3 million documents.
|
|
73
|
+
- Complete source code for the Twitch platform.
|
|
74
|
+
- An unreleased Steam competitor from Amazon Game Studios.
|
|
75
|
+
- Creator payout details and proprietary SDKs.
|
|
76
|
+
- **6,600 embedded secrets** in Git repos: 194 AWS keys, 69 Twilio keys, 68 Google
|
|
77
|
+
API keys, hundreds of database connection strings, 14 GitHub OAuth keys, 4 Stripe keys.
|
|
78
|
+
|
|
79
|
+
Root cause: A server configuration change inadvertently made internal Git/backup servers
|
|
80
|
+
accessible externally. The scale of embedded secrets demonstrated systemic secrets
|
|
81
|
+
management failure.
|
|
82
|
+
|
|
83
|
+
**S3 Ransomware Campaign (2025) — 158 Million AWS Keys**
|
|
84
|
+
|
|
85
|
+
In early 2025, security researchers discovered a public server containing over 158 million
|
|
86
|
+
AWS secret key records. Attackers used 1,229 verified active keys to encrypt S3 buckets
|
|
87
|
+
and demand ransom payments. The campaign exploited organizations that failed to rotate
|
|
88
|
+
credentials and lacked S3 versioning or cross-region replication backups.
|
|
89
|
+
|
|
90
|
+
**Automotive Giant Data Leak (2023-2025)**
|
|
91
|
+
|
|
92
|
+
A major automotive manufacturer exposed hundreds of S3 buckets containing customer
|
|
93
|
+
databases, invoices, and fleet-telemetry data due to misconfigured bucket policies.
|
|
94
|
+
One bucket exceeded 70 terabytes. The misconfiguration persisted for years before
|
|
95
|
+
public disclosure in late 2025.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 2. Core Security Principles
|
|
100
|
+
|
|
101
|
+
### 2.1 Least Privilege IAM
|
|
102
|
+
|
|
103
|
+
Every identity — human, service, or machine — receives only the permissions required
|
|
104
|
+
for its specific function. No more, no less.
|
|
105
|
+
|
|
106
|
+
- Use IAM Access Analyzer to identify unused permissions and generate least-privilege policies.
|
|
107
|
+
- Set permissions boundaries to cap the maximum permissions any role can receive.
|
|
108
|
+
- Prefer managed policies scoped to specific services over inline policies.
|
|
109
|
+
- Require conditions (source IP, MFA, time of day, VPC endpoint) on all sensitive actions.
|
|
110
|
+
- Use AWS Organizations Service Control Policies (SCPs) as guardrails across accounts.
|
|
111
|
+
|
|
112
|
+
### 2.2 MFA Everywhere
|
|
113
|
+
|
|
114
|
+
- Enforce MFA on the root account — use a hardware security key (FIDO2/U2F).
|
|
115
|
+
- Require MFA for all IAM users with console access.
|
|
116
|
+
- Use `aws:MultiFactorAuthPresent` condition in policies for sensitive operations.
|
|
117
|
+
- Prefer IAM Identity Center (SSO) with MFA over long-lived IAM user credentials.
|
|
118
|
+
|
|
119
|
+
### 2.3 VPC Isolation
|
|
120
|
+
|
|
121
|
+
- Deploy workloads in private subnets; use NAT gateways for outbound internet access.
|
|
122
|
+
- Use VPC endpoints (Gateway for S3/DynamoDB, Interface for other services) to keep
|
|
123
|
+
traffic within the AWS network.
|
|
124
|
+
- Segment environments (dev/staging/prod) into separate VPCs or accounts.
|
|
125
|
+
- Use AWS Transit Gateway for controlled cross-VPC communication.
|
|
126
|
+
|
|
127
|
+
### 2.4 Encryption by Default
|
|
128
|
+
|
|
129
|
+
- Enable default encryption on S3 buckets (SSE-S3 minimum, SSE-KMS preferred).
|
|
130
|
+
- Encrypt EBS volumes, RDS instances, DynamoDB tables, and ElastiCache at rest.
|
|
131
|
+
- Enforce TLS 1.2+ for all data in transit.
|
|
132
|
+
- Use AWS KMS with customer-managed keys (CMKs) for regulated workloads.
|
|
133
|
+
- Enable key rotation on all KMS keys (automatic annual rotation or shorter).
|
|
134
|
+
|
|
135
|
+
### 2.5 Log Everything
|
|
136
|
+
|
|
137
|
+
- Enable CloudTrail in all regions with multi-region trail configuration.
|
|
138
|
+
- Enable CloudTrail log file validation (digest files) to detect tampering.
|
|
139
|
+
- Store CloudTrail logs in a dedicated, separate-account S3 bucket with Object Lock.
|
|
140
|
+
- Enable VPC Flow Logs for network traffic analysis.
|
|
141
|
+
- Enable S3 access logging, ELB access logs, and CloudFront access logs.
|
|
142
|
+
- Centralize logs in a security account using AWS Organizations.
|
|
143
|
+
|
|
144
|
+
### 2.6 Security Automation
|
|
145
|
+
|
|
146
|
+
- Use AWS Config Rules for continuous compliance monitoring.
|
|
147
|
+
- Deploy GuardDuty for intelligent threat detection across accounts.
|
|
148
|
+
- Automate remediation with Lambda functions triggered by Config/GuardDuty findings.
|
|
149
|
+
- Implement Infrastructure as Code (IaC) and scan it before deployment.
|
|
150
|
+
- Use CI/CD pipeline security gates (checkov, tfsec) to prevent insecure deployments.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 3. Implementation Patterns
|
|
155
|
+
|
|
156
|
+
### 3.1 IAM Policies — Least Privilege with Conditions
|
|
157
|
+
|
|
158
|
+
**Insecure — Wildcard admin policy (never do this):**
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"Version": "2012-10-17",
|
|
163
|
+
"Statement": [{
|
|
164
|
+
"Effect": "Allow",
|
|
165
|
+
"Action": "*",
|
|
166
|
+
"Resource": "*"
|
|
167
|
+
}]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Secure — Scoped policy with conditions:**
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"Version": "2012-10-17",
|
|
176
|
+
"Statement": [{
|
|
177
|
+
"Sid": "AllowS3ReadSpecificBucket",
|
|
178
|
+
"Effect": "Allow",
|
|
179
|
+
"Action": [
|
|
180
|
+
"s3:GetObject",
|
|
181
|
+
"s3:ListBucket"
|
|
182
|
+
],
|
|
183
|
+
"Resource": [
|
|
184
|
+
"arn:aws:s3:::my-app-data-bucket",
|
|
185
|
+
"arn:aws:s3:::my-app-data-bucket/*"
|
|
186
|
+
],
|
|
187
|
+
"Condition": {
|
|
188
|
+
"StringEquals": {
|
|
189
|
+
"aws:RequestedRegion": "us-east-1"
|
|
190
|
+
},
|
|
191
|
+
"Bool": {
|
|
192
|
+
"aws:SecureTransport": "true"
|
|
193
|
+
},
|
|
194
|
+
"IpAddress": {
|
|
195
|
+
"aws:SourceIp": "10.0.0.0/8"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}]
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Permissions boundary — cap delegated permissions:**
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"Version": "2012-10-17",
|
|
207
|
+
"Statement": [
|
|
208
|
+
{
|
|
209
|
+
"Sid": "AllowSpecificServices",
|
|
210
|
+
"Effect": "Allow",
|
|
211
|
+
"Action": [
|
|
212
|
+
"s3:*",
|
|
213
|
+
"dynamodb:*",
|
|
214
|
+
"lambda:*",
|
|
215
|
+
"logs:*",
|
|
216
|
+
"cloudwatch:*"
|
|
217
|
+
],
|
|
218
|
+
"Resource": "*"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"Sid": "DenySecurityServices",
|
|
222
|
+
"Effect": "Deny",
|
|
223
|
+
"Action": [
|
|
224
|
+
"iam:CreateUser",
|
|
225
|
+
"iam:CreateRole",
|
|
226
|
+
"iam:AttachRolePolicy",
|
|
227
|
+
"organizations:*",
|
|
228
|
+
"account:*"
|
|
229
|
+
],
|
|
230
|
+
"Resource": "*"
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 3.2 S3 Security
|
|
237
|
+
|
|
238
|
+
**Block all public access (account level):**
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"BlockPublicAcls": true,
|
|
243
|
+
"IgnorePublicAcls": true,
|
|
244
|
+
"BlockPublicPolicy": true,
|
|
245
|
+
"RestrictPublicBuckets": true
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Secure bucket policy — enforce TLS and deny unencrypted uploads:**
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"Version": "2012-10-17",
|
|
254
|
+
"Statement": [
|
|
255
|
+
{
|
|
256
|
+
"Sid": "DenyInsecureTransport",
|
|
257
|
+
"Effect": "Deny",
|
|
258
|
+
"Principal": "*",
|
|
259
|
+
"Action": "s3:*",
|
|
260
|
+
"Resource": [
|
|
261
|
+
"arn:aws:s3:::my-secure-bucket",
|
|
262
|
+
"arn:aws:s3:::my-secure-bucket/*"
|
|
263
|
+
],
|
|
264
|
+
"Condition": {
|
|
265
|
+
"Bool": { "aws:SecureTransport": "false" }
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"Sid": "DenyUnencryptedUploads",
|
|
270
|
+
"Effect": "Deny",
|
|
271
|
+
"Principal": "*",
|
|
272
|
+
"Action": "s3:PutObject",
|
|
273
|
+
"Resource": "arn:aws:s3:::my-secure-bucket/*",
|
|
274
|
+
"Condition": {
|
|
275
|
+
"StringNotEquals": {
|
|
276
|
+
"s3:x-amz-server-side-encryption": "aws:kms"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### 3.3 VPC Security — Security Groups and NACLs
|
|
285
|
+
|
|
286
|
+
**Insecure security group (never do this):**
|
|
287
|
+
|
|
288
|
+
```hcl
|
|
289
|
+
# BAD: Open to the world on all ports
|
|
290
|
+
resource "aws_security_group" "bad_example" {
|
|
291
|
+
ingress {
|
|
292
|
+
from_port = 0
|
|
293
|
+
to_port = 65535
|
|
294
|
+
protocol = "tcp"
|
|
295
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Secure security group (Terraform):**
|
|
301
|
+
|
|
302
|
+
```hcl
|
|
303
|
+
resource "aws_security_group" "web_server" {
|
|
304
|
+
name = "web-server-sg"
|
|
305
|
+
description = "Allow HTTPS from CloudFront only"
|
|
306
|
+
vpc_id = aws_vpc.main.id
|
|
307
|
+
|
|
308
|
+
ingress {
|
|
309
|
+
description = "HTTPS from CloudFront"
|
|
310
|
+
from_port = 443
|
|
311
|
+
to_port = 443
|
|
312
|
+
protocol = "tcp"
|
|
313
|
+
prefix_list_ids = [data.aws_ec2_managed_prefix_list.cloudfront.id]
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
egress {
|
|
317
|
+
description = "Allow outbound to VPC only"
|
|
318
|
+
from_port = 0
|
|
319
|
+
to_port = 0
|
|
320
|
+
protocol = "-1"
|
|
321
|
+
cidr_blocks = [aws_vpc.main.cidr_block]
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
tags = {
|
|
325
|
+
Name = "web-server-sg"
|
|
326
|
+
Environment = "production"
|
|
327
|
+
ManagedBy = "terraform"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**VPC endpoint for S3 (keeps traffic off the internet):**
|
|
333
|
+
|
|
334
|
+
```hcl
|
|
335
|
+
resource "aws_vpc_endpoint" "s3" {
|
|
336
|
+
vpc_id = aws_vpc.main.id
|
|
337
|
+
service_name = "com.amazonaws.us-east-1.s3"
|
|
338
|
+
vpc_endpoint_type = "Gateway"
|
|
339
|
+
route_table_ids = [aws_route_table.private.id]
|
|
340
|
+
|
|
341
|
+
policy = jsonencode({
|
|
342
|
+
Version = "2012-10-17"
|
|
343
|
+
Statement = [{
|
|
344
|
+
Sid = "AllowSpecificBucket"
|
|
345
|
+
Effect = "Allow"
|
|
346
|
+
Principal = "*"
|
|
347
|
+
Action = ["s3:GetObject", "s3:PutObject"]
|
|
348
|
+
Resource = ["arn:aws:s3:::my-app-bucket/*"]
|
|
349
|
+
}]
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### 3.4 KMS Key Management
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"Version": "2012-10-17",
|
|
359
|
+
"Statement": [
|
|
360
|
+
{
|
|
361
|
+
"Sid": "AllowKeyAdministration",
|
|
362
|
+
"Effect": "Allow",
|
|
363
|
+
"Principal": { "AWS": "arn:aws:iam::123456789012:role/KeyAdminRole" },
|
|
364
|
+
"Action": [
|
|
365
|
+
"kms:Create*",
|
|
366
|
+
"kms:Describe*",
|
|
367
|
+
"kms:Enable*",
|
|
368
|
+
"kms:List*",
|
|
369
|
+
"kms:Put*",
|
|
370
|
+
"kms:Update*",
|
|
371
|
+
"kms:Revoke*",
|
|
372
|
+
"kms:Disable*",
|
|
373
|
+
"kms:Get*",
|
|
374
|
+
"kms:Delete*",
|
|
375
|
+
"kms:ScheduleKeyDeletion",
|
|
376
|
+
"kms:CancelKeyDeletion"
|
|
377
|
+
],
|
|
378
|
+
"Resource": "*"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"Sid": "AllowKeyUsage",
|
|
382
|
+
"Effect": "Allow",
|
|
383
|
+
"Principal": { "AWS": "arn:aws:iam::123456789012:role/AppRole" },
|
|
384
|
+
"Action": [
|
|
385
|
+
"kms:Encrypt",
|
|
386
|
+
"kms:Decrypt",
|
|
387
|
+
"kms:ReEncrypt*",
|
|
388
|
+
"kms:GenerateDataKey*",
|
|
389
|
+
"kms:DescribeKey"
|
|
390
|
+
],
|
|
391
|
+
"Resource": "*"
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Separate key administration from key usage. The admin role can manage key lifecycle but
|
|
398
|
+
cannot encrypt/decrypt data. The application role can use the key but cannot modify or
|
|
399
|
+
delete it.
|
|
400
|
+
|
|
401
|
+
### 3.5 Secrets Manager
|
|
402
|
+
|
|
403
|
+
- Store all application secrets (database passwords, API keys, tokens) in AWS Secrets
|
|
404
|
+
Manager or SSM Parameter Store (SecureString type).
|
|
405
|
+
- Enable automatic rotation with Lambda rotation functions.
|
|
406
|
+
- Reference secrets by ARN in application code — never embed values.
|
|
407
|
+
- Use resource policies to restrict which IAM roles can access each secret.
|
|
408
|
+
- Audit secret access via CloudTrail `GetSecretValue` events.
|
|
409
|
+
|
|
410
|
+
### 3.6 WAF and CloudFront Security
|
|
411
|
+
|
|
412
|
+
- Deploy AWS WAF in front of CloudFront, ALB, or API Gateway.
|
|
413
|
+
- Enable AWS Managed Rule Groups: Core Rule Set (CRS), Known Bad Inputs, SQL Injection,
|
|
414
|
+
IP Reputation.
|
|
415
|
+
- Use rate-based rules to mitigate DDoS and brute-force attacks.
|
|
416
|
+
- Configure CloudFront with Origin Access Control (OAC) for S3 origins — not legacy OAI.
|
|
417
|
+
- Set minimum TLS 1.2 on CloudFront distributions.
|
|
418
|
+
- Use custom response headers: `Strict-Transport-Security`, `X-Content-Type-Options`,
|
|
419
|
+
`X-Frame-Options`.
|
|
420
|
+
|
|
421
|
+
### 3.7 Lambda Security
|
|
422
|
+
|
|
423
|
+
- Grant each Lambda function its own IAM execution role — never share roles between functions.
|
|
424
|
+
- Scope permissions to the exact resources the function accesses.
|
|
425
|
+
- Use environment variable encryption with KMS for sensitive configuration.
|
|
426
|
+
- Set reserved concurrency limits to prevent runaway invocations.
|
|
427
|
+
- Use VPC-attached Lambda for accessing private resources; add VPC endpoints for
|
|
428
|
+
AWS service calls.
|
|
429
|
+
- For function URLs: use `AuthType AWS_IAM` (not `NONE`) in production.
|
|
430
|
+
- As of October 2025, new function URLs require both `lambda:InvokeFunctionUrl` and
|
|
431
|
+
`lambda:InvokeFunction` permissions.
|
|
432
|
+
- Validate and sanitize all input — Lambda functions are not immune to injection attacks.
|
|
433
|
+
|
|
434
|
+
### 3.8 RDS Security
|
|
435
|
+
|
|
436
|
+
- Deploy RDS instances in private subnets only — never assign public IP addresses.
|
|
437
|
+
- Enable encryption at rest (KMS) and enforce SSL/TLS for connections.
|
|
438
|
+
- Use IAM database authentication instead of static passwords where supported.
|
|
439
|
+
- Enable automated backups with point-in-time recovery.
|
|
440
|
+
- Enable Enhanced Monitoring and Performance Insights.
|
|
441
|
+
- Use security groups to restrict access to application subnets only.
|
|
442
|
+
- Enable deletion protection on production databases.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## 4. Vulnerability Catalog
|
|
447
|
+
|
|
448
|
+
### VULN-AWS-001: S3 Public Bucket Exposure
|
|
449
|
+
|
|
450
|
+
- **Severity:** Critical
|
|
451
|
+
- **CWE:** CWE-284 (Improper Access Control)
|
|
452
|
+
- **Description:** S3 buckets with public ACLs or bucket policies exposing data to the internet.
|
|
453
|
+
- **Impact:** Data breach, regulatory fines, reputational damage.
|
|
454
|
+
- **Detection:** AWS Config rule `s3-bucket-public-read-prohibited`, Security Hub, Prowler.
|
|
455
|
+
- **Remediation:** Enable S3 Block Public Access at the account level. Review and remove
|
|
456
|
+
public ACLs and bucket policies. Use VPC endpoints for internal access.
|
|
457
|
+
|
|
458
|
+
### VULN-AWS-002: IAM Wildcard Policies
|
|
459
|
+
|
|
460
|
+
- **Severity:** Critical
|
|
461
|
+
- **CWE:** CWE-250 (Execution with Unnecessary Privileges)
|
|
462
|
+
- **Description:** IAM policies using `"Action": "*"` or `"Resource": "*"` granting
|
|
463
|
+
unrestricted access.
|
|
464
|
+
- **Impact:** Lateral movement, privilege escalation, full account compromise.
|
|
465
|
+
- **Detection:** IAM Access Analyzer, AWS Config rule `iam-policy-no-statements-with-admin-access`.
|
|
466
|
+
- **Remediation:** Replace wildcards with specific actions and resource ARNs. Use
|
|
467
|
+
permissions boundaries. Audit with Access Analyzer.
|
|
468
|
+
|
|
469
|
+
### VULN-AWS-003: IMDSv1 SSRF Credential Theft
|
|
470
|
+
|
|
471
|
+
- **Severity:** Critical
|
|
472
|
+
- **CWE:** CWE-918 (Server-Side Request Forgery)
|
|
473
|
+
- **Description:** EC2 instances using IMDSv1 allow unauthenticated HTTP GET requests to
|
|
474
|
+
`169.254.169.254`, enabling SSRF attacks to steal IAM role credentials.
|
|
475
|
+
- **Impact:** Full credential theft for the attached IAM role. Root cause of Capital One breach.
|
|
476
|
+
- **Detection:** AWS Config rule `ec2-imdsv2-check`, Prowler check `ec2_imdsv2_enabled`.
|
|
477
|
+
- **Remediation:** Enforce IMDSv2 on all EC2 instances:
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
aws ec2 modify-instance-metadata-options \
|
|
481
|
+
--instance-id i-1234567890abcdef0 \
|
|
482
|
+
--http-tokens required \
|
|
483
|
+
--http-put-response-hop-limit 1 \
|
|
484
|
+
--http-endpoint enabled
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
IMDSv2 requires a PUT request with a custom header to obtain a session token,
|
|
488
|
+
blocking most SSRF exploits that can only issue GET requests.
|
|
489
|
+
|
|
490
|
+
### VULN-AWS-004: Unencrypted EBS Volumes
|
|
491
|
+
|
|
492
|
+
- **Severity:** High
|
|
493
|
+
- **CWE:** CWE-311 (Missing Encryption of Sensitive Data)
|
|
494
|
+
- **Description:** EBS volumes storing data without encryption at rest.
|
|
495
|
+
- **Impact:** Data exposure if volumes are shared, snapshot is made public, or physical
|
|
496
|
+
media is compromised.
|
|
497
|
+
- **Detection:** AWS Config rule `encrypted-volumes`, Security Hub.
|
|
498
|
+
- **Remediation:** Enable default EBS encryption in account settings. Encrypt existing
|
|
499
|
+
volumes by creating encrypted snapshots and restoring.
|
|
500
|
+
|
|
501
|
+
### VULN-AWS-005: Unencrypted RDS Instances
|
|
502
|
+
|
|
503
|
+
- **Severity:** High
|
|
504
|
+
- **CWE:** CWE-311 (Missing Encryption of Sensitive Data)
|
|
505
|
+
- **Description:** RDS instances without encryption at rest or SSL/TLS enforcement.
|
|
506
|
+
- **Impact:** Database contents exposed at rest or in transit.
|
|
507
|
+
- **Detection:** AWS Config rule `rds-storage-encrypted`, `rds-cluster-encryption-at-rest-check`.
|
|
508
|
+
- **Remediation:** Enable encryption at creation (cannot be added to existing instances —
|
|
509
|
+
must create encrypted snapshot and restore). Enforce SSL via RDS parameter group
|
|
510
|
+
`rds.force_ssl = 1`.
|
|
511
|
+
|
|
512
|
+
### VULN-AWS-006: Overly Permissive Security Groups
|
|
513
|
+
|
|
514
|
+
- **Severity:** High
|
|
515
|
+
- **CWE:** CWE-284 (Improper Access Control)
|
|
516
|
+
- **Description:** Security groups allowing inbound traffic from `0.0.0.0/0` on
|
|
517
|
+
sensitive ports (22, 3389, 3306, 5432, 6379, 27017).
|
|
518
|
+
- **Impact:** Unauthorized access to SSH, RDP, databases, caches.
|
|
519
|
+
- **Detection:** AWS Config rules `restricted-ssh`, `restricted-common-ports`, Security Hub.
|
|
520
|
+
- **Remediation:** Restrict ingress to specific CIDR ranges or security group references.
|
|
521
|
+
Use AWS Systems Manager Session Manager instead of SSH. Use VPN or Direct Connect
|
|
522
|
+
for administrative access.
|
|
523
|
+
|
|
524
|
+
### VULN-AWS-007: Root Account Usage
|
|
525
|
+
|
|
526
|
+
- **Severity:** Critical
|
|
527
|
+
- **CWE:** CWE-250 (Execution with Unnecessary Privileges)
|
|
528
|
+
- **Description:** Using the AWS root account for daily operations instead of federated
|
|
529
|
+
IAM roles or IAM Identity Center.
|
|
530
|
+
- **Impact:** Root has unrestricted access — compromise means total account takeover.
|
|
531
|
+
- **Detection:** CloudTrail events with `userIdentity.type = Root`, AWS Config rule
|
|
532
|
+
`root-account-mfa-enabled`.
|
|
533
|
+
- **Remediation:** Enable MFA on root (hardware key). Create IAM roles for all operations.
|
|
534
|
+
Use root only for tasks that require it (account-level settings). Set up CloudWatch
|
|
535
|
+
alarm for root login events.
|
|
536
|
+
|
|
537
|
+
### VULN-AWS-008: Missing CloudTrail
|
|
538
|
+
|
|
539
|
+
- **Severity:** Critical
|
|
540
|
+
- **CWE:** CWE-778 (Insufficient Logging)
|
|
541
|
+
- **Description:** CloudTrail not enabled or not covering all regions, preventing
|
|
542
|
+
audit and forensic investigation.
|
|
543
|
+
- **Impact:** No visibility into API calls. Cannot detect or investigate breaches.
|
|
544
|
+
- **Detection:** AWS Config rule `cloud-trail-enabled`, `multi-region-cloud-trail-enabled`.
|
|
545
|
+
- **Remediation:** Enable multi-region CloudTrail with log file validation. Store logs
|
|
546
|
+
in a dedicated S3 bucket with Object Lock (WORM). Enable CloudTrail Insights for
|
|
547
|
+
anomaly detection.
|
|
548
|
+
|
|
549
|
+
### VULN-AWS-009: Lambda Function URL Without Auth
|
|
550
|
+
|
|
551
|
+
- **Severity:** High
|
|
552
|
+
- **CWE:** CWE-306 (Missing Authentication for Critical Function)
|
|
553
|
+
- **Description:** Lambda function URLs configured with `AuthType: NONE`, making them
|
|
554
|
+
publicly accessible without authentication.
|
|
555
|
+
- **Impact:** Unauthorized invocation, data exfiltration, resource abuse, cost explosion.
|
|
556
|
+
- **Detection:** AWS Config custom rule, Prowler, manual review.
|
|
557
|
+
- **Remediation:** Set `AuthType: AWS_IAM` for production functions. Use API Gateway
|
|
558
|
+
with authorizers for complex authentication requirements. If public access is
|
|
559
|
+
required, add WAF and rate limiting.
|
|
560
|
+
|
|
561
|
+
### VULN-AWS-010: Cross-Account Role Trust Too Broad
|
|
562
|
+
|
|
563
|
+
- **Severity:** High
|
|
564
|
+
- **CWE:** CWE-284 (Improper Access Control)
|
|
565
|
+
- **Description:** IAM role trust policies allowing `"Principal": {"AWS": "*"}` or
|
|
566
|
+
overly broad account trust without external ID conditions.
|
|
567
|
+
- **Impact:** Any AWS account can assume the role and access resources.
|
|
568
|
+
- **Detection:** IAM Access Analyzer external access findings.
|
|
569
|
+
- **Remediation:** Specify exact account IDs in trust policies. Require `sts:ExternalId`
|
|
570
|
+
condition for third-party cross-account access. Use AWS Organizations conditions
|
|
571
|
+
(`aws:PrincipalOrgID`) where applicable.
|
|
572
|
+
|
|
573
|
+
### VULN-AWS-011: Unrotated Access Keys
|
|
574
|
+
|
|
575
|
+
- **Severity:** Medium
|
|
576
|
+
- **CWE:** CWE-324 (Use of a Key Past its Expiration Date)
|
|
577
|
+
- **Description:** IAM user access keys not rotated within 90 days.
|
|
578
|
+
- **Impact:** Stale credentials increase window of exposure if compromised.
|
|
579
|
+
- **Detection:** AWS Config rule `access-keys-rotated`, IAM Credential Report.
|
|
580
|
+
- **Remediation:** Rotate access keys every 90 days. Prefer IAM roles with temporary
|
|
581
|
+
credentials over long-lived access keys. Use IAM Identity Center for human access.
|
|
582
|
+
|
|
583
|
+
### VULN-AWS-012: S3 Bucket Without Versioning
|
|
584
|
+
|
|
585
|
+
- **Severity:** Medium
|
|
586
|
+
- **CWE:** CWE-693 (Protection Mechanism Failure)
|
|
587
|
+
- **Description:** S3 buckets without versioning enabled, preventing recovery from
|
|
588
|
+
accidental deletion or ransomware encryption.
|
|
589
|
+
- **Impact:** Permanent data loss from accidental or malicious deletion.
|
|
590
|
+
- **Detection:** AWS Config rule `s3-bucket-versioning-enabled`.
|
|
591
|
+
- **Remediation:** Enable versioning on all buckets. Combine with Object Lock for
|
|
592
|
+
immutable backups. Set lifecycle policies to manage version storage costs.
|
|
593
|
+
|
|
594
|
+
### VULN-AWS-013: CloudFront Without WAF
|
|
595
|
+
|
|
596
|
+
- **Severity:** Medium
|
|
597
|
+
- **CWE:** CWE-693 (Protection Mechanism Failure)
|
|
598
|
+
- **Description:** CloudFront distributions serving web applications without AWS WAF
|
|
599
|
+
protection.
|
|
600
|
+
- **Impact:** Exposure to SQL injection, XSS, DDoS, bot attacks.
|
|
601
|
+
- **Detection:** AWS Config rule, Security Hub.
|
|
602
|
+
- **Remediation:** Associate AWS WAF web ACL with CloudFront distribution. Enable
|
|
603
|
+
AWS Managed Rule Groups. Configure rate-based rules.
|
|
604
|
+
|
|
605
|
+
### VULN-AWS-014: ECS/EKS Task Roles Too Permissive
|
|
606
|
+
|
|
607
|
+
- **Severity:** High
|
|
608
|
+
- **CWE:** CWE-250 (Execution with Unnecessary Privileges)
|
|
609
|
+
- **Description:** Container task roles with broad permissions shared across services.
|
|
610
|
+
- **Impact:** Container escape or compromise leads to lateral movement.
|
|
611
|
+
- **Detection:** IAM Access Analyzer, Prowler.
|
|
612
|
+
- **Remediation:** Assign per-task IAM roles with minimum required permissions. Use
|
|
613
|
+
EKS Pod Identity or IRSA (IAM Roles for Service Accounts) for Kubernetes workloads.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## 5. Security Checklist
|
|
618
|
+
|
|
619
|
+
### Identity and Access Management
|
|
620
|
+
- [ ] Root account has hardware MFA enabled and no access keys
|
|
621
|
+
- [ ] All IAM users have MFA enabled for console access
|
|
622
|
+
- [ ] No IAM policies use `"Action": "*"` or `"Resource": "*"`
|
|
623
|
+
- [ ] Permissions boundaries are set for delegated administration
|
|
624
|
+
- [ ] IAM access keys are rotated within 90 days
|
|
625
|
+
- [ ] Unused IAM users, roles, and credentials are removed
|
|
626
|
+
- [ ] IAM Identity Center (SSO) is used for human access
|
|
627
|
+
- [ ] Service Control Policies (SCPs) restrict dangerous actions at the org level
|
|
628
|
+
|
|
629
|
+
### Data Protection
|
|
630
|
+
- [ ] S3 Block Public Access enabled at account level
|
|
631
|
+
- [ ] All S3 buckets have default encryption (SSE-KMS preferred)
|
|
632
|
+
- [ ] S3 bucket policies enforce TLS (`aws:SecureTransport`)
|
|
633
|
+
- [ ] EBS default encryption enabled in account settings
|
|
634
|
+
- [ ] RDS instances encrypted at rest with KMS
|
|
635
|
+
- [ ] KMS key rotation enabled (annual minimum)
|
|
636
|
+
- [ ] Secrets stored in Secrets Manager or SSM Parameter Store (not in code)
|
|
637
|
+
|
|
638
|
+
### Network Security
|
|
639
|
+
- [ ] No security groups allow 0.0.0.0/0 ingress on ports 22, 3389, or database ports
|
|
640
|
+
- [ ] Workloads deployed in private subnets
|
|
641
|
+
- [ ] VPC endpoints configured for S3, DynamoDB, and other frequently-used services
|
|
642
|
+
- [ ] VPC Flow Logs enabled on all VPCs
|
|
643
|
+
- [ ] WAF deployed in front of all public-facing endpoints
|
|
644
|
+
|
|
645
|
+
### Monitoring and Detection
|
|
646
|
+
- [ ] CloudTrail enabled in all regions with log file validation
|
|
647
|
+
- [ ] CloudTrail logs stored in a separate account with Object Lock
|
|
648
|
+
- [ ] GuardDuty enabled in all accounts and regions
|
|
649
|
+
- [ ] Security Hub enabled with CIS AWS Foundations Benchmark v5.0
|
|
650
|
+
- [ ] CloudWatch alarms configured for root account login
|
|
651
|
+
- [ ] AWS Config enabled with required rules in all regions
|
|
652
|
+
|
|
653
|
+
### Compute Security
|
|
654
|
+
- [ ] IMDSv2 enforced on all EC2 instances
|
|
655
|
+
- [ ] Lambda functions have dedicated, least-privilege execution roles
|
|
656
|
+
- [ ] Lambda function URLs use `AuthType AWS_IAM` in production
|
|
657
|
+
- [ ] ECS/EKS workloads use per-task/per-pod IAM roles
|
|
658
|
+
- [ ] AMIs are hardened and regularly patched
|
|
659
|
+
|
|
660
|
+
### Incident Response
|
|
661
|
+
- [ ] Incident response runbooks documented and tested
|
|
662
|
+
- [ ] GuardDuty findings integrated with alerting (SNS, PagerDuty, Slack)
|
|
663
|
+
- [ ] Automated remediation for high-severity findings
|
|
664
|
+
- [ ] AWS Detective enabled for investigation workflows
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
## 6. Tools and Automation
|
|
669
|
+
|
|
670
|
+
### AWS-Native Security Services
|
|
671
|
+
|
|
672
|
+
| Service | Purpose |
|
|
673
|
+
|---------------------|---------------------------------------------------------------|
|
|
674
|
+
| **Security Hub** | Centralized security findings aggregation, compliance scoring |
|
|
675
|
+
| **GuardDuty** | Intelligent threat detection using ML, anomaly detection |
|
|
676
|
+
| **IAM Access Analyzer** | Identifies unused access, external access, policy validation |
|
|
677
|
+
| **AWS Config** | Continuous configuration compliance monitoring, auto-remediation |
|
|
678
|
+
| **CloudTrail** | API audit logging across all AWS services |
|
|
679
|
+
| **Detective** | Root cause investigation using graph analysis |
|
|
680
|
+
| **Inspector** | Automated vulnerability scanning for EC2, Lambda, ECR |
|
|
681
|
+
| **Macie** | S3 data classification, PII/sensitive data discovery |
|
|
682
|
+
| **KMS** | Key management, encryption, digital signing |
|
|
683
|
+
| **WAF** | Web application firewall with managed and custom rules |
|
|
684
|
+
| **Shield** | DDoS protection (Standard free, Advanced paid) |
|
|
685
|
+
| **Firewall Manager**| Centralized security policy management across accounts |
|
|
686
|
+
|
|
687
|
+
### Open-Source Security Tools
|
|
688
|
+
|
|
689
|
+
**Prowler** — AWS/Azure/GCP/K8s security auditing. Runs 300+ checks against CIS,
|
|
690
|
+
NIST 800-53, GDPR, HIPAA, PCI-DSS. Generates findings in JSON, CSV, HTML, JUnit-XML.
|
|
691
|
+
Completes scans in 5-15 minutes. Integrates with Security Hub.
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
# Install and run Prowler against all CIS checks
|
|
695
|
+
pip install prowler
|
|
696
|
+
prowler aws --compliance cis_3.0_aws
|
|
697
|
+
prowler aws --severity critical high --output-formats json html
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
**ScoutSuite** — Multi-cloud security auditor that collects configuration data via
|
|
701
|
+
APIs and generates an interactive HTML report. Analyzes EC2, S3, IAM, RDS, VPC, and
|
|
702
|
+
other services against security best practices and CIS standards.
|
|
703
|
+
|
|
704
|
+
```bash
|
|
705
|
+
# Install and run ScoutSuite
|
|
706
|
+
pip install scoutsuite
|
|
707
|
+
scout aws --report-dir ./scout-report
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Steampipe** — Query AWS APIs using SQL. Zero-ETL approach connects to 500+ data
|
|
711
|
+
sources. Includes compliance benchmarks as code.
|
|
712
|
+
|
|
713
|
+
```bash
|
|
714
|
+
# Install and run CIS benchmark
|
|
715
|
+
steampipe plugin install aws
|
|
716
|
+
steampipe check benchmark.cis_v300
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
**Checkov** — Static analysis for IaC (Terraform, CloudFormation, Kubernetes, Helm).
|
|
720
|
+
2000+ built-in policies. Runs in CI/CD pipelines.
|
|
721
|
+
|
|
722
|
+
```bash
|
|
723
|
+
# Scan Terraform files
|
|
724
|
+
pip install checkov
|
|
725
|
+
checkov -d ./terraform/ --framework terraform --check HIGH,CRITICAL
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
**tfsec** — Terraform-focused static security scanner by Aqua Security. Fast Go-based
|
|
729
|
+
analysis with low false-positive rate.
|
|
730
|
+
|
|
731
|
+
```bash
|
|
732
|
+
# Scan Terraform files
|
|
733
|
+
brew install tfsec
|
|
734
|
+
tfsec ./terraform/ --minimum-severity HIGH
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
### CI/CD Integration Pattern
|
|
738
|
+
|
|
739
|
+
```yaml
|
|
740
|
+
# GitHub Actions example: IaC security scanning
|
|
741
|
+
name: Security Scan
|
|
742
|
+
on: [pull_request]
|
|
743
|
+
jobs:
|
|
744
|
+
iac-scan:
|
|
745
|
+
runs-on: ubuntu-latest
|
|
746
|
+
steps:
|
|
747
|
+
- uses: actions/checkout@v4
|
|
748
|
+
- name: Run Checkov
|
|
749
|
+
uses: bridgecrewio/checkov-action@v12
|
|
750
|
+
with:
|
|
751
|
+
directory: ./terraform
|
|
752
|
+
framework: terraform
|
|
753
|
+
output_format: sarif
|
|
754
|
+
soft_fail: false
|
|
755
|
+
- name: Run tfsec
|
|
756
|
+
uses: aquasecurity/tfsec-action@v1.0.3
|
|
757
|
+
with:
|
|
758
|
+
working_directory: ./terraform
|
|
759
|
+
soft_fail: false
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
## 7. Platform-Specific Guidance
|
|
765
|
+
|
|
766
|
+
### 7.1 EC2
|
|
767
|
+
|
|
768
|
+
- Enforce IMDSv2 (`http-tokens: required`, `http-put-response-hop-limit: 1`).
|
|
769
|
+
- Use AWS Systems Manager Session Manager instead of SSH (no open port 22).
|
|
770
|
+
- Harden AMIs: remove default users, disable password auth, install security agents.
|
|
771
|
+
- Use EC2 Instance Connect for emergency SSH access (temporary keys).
|
|
772
|
+
- Enable detailed monitoring and install CloudWatch Agent.
|
|
773
|
+
- Use launch templates with encrypted EBS volumes and IMDSv2 enforcement.
|
|
774
|
+
- Apply security patches via Systems Manager Patch Manager on a regular schedule.
|
|
775
|
+
|
|
776
|
+
### 7.2 S3
|
|
777
|
+
|
|
778
|
+
- Enable S3 Block Public Access at the account level (non-negotiable).
|
|
779
|
+
- Enable default encryption (SSE-KMS for regulated data, SSE-S3 minimum).
|
|
780
|
+
- Enable versioning and consider Object Lock for compliance/backup buckets.
|
|
781
|
+
- Enable S3 access logging to a dedicated logging bucket.
|
|
782
|
+
- Use S3 Lifecycle policies to transition/expire objects and reduce attack surface.
|
|
783
|
+
- Use VPC endpoints for application access — avoid exposing buckets publicly.
|
|
784
|
+
- Enable Macie for automated PII/sensitive data classification.
|
|
785
|
+
|
|
786
|
+
### 7.3 RDS
|
|
787
|
+
|
|
788
|
+
- Deploy in private subnets only. Never enable public accessibility.
|
|
789
|
+
- Enforce SSL/TLS connections via parameter group (`rds.force_ssl = 1`).
|
|
790
|
+
- Use IAM database authentication where supported (MySQL, PostgreSQL).
|
|
791
|
+
- Enable encryption at rest with customer-managed KMS keys.
|
|
792
|
+
- Configure automated backups (35-day retention for production).
|
|
793
|
+
- Enable deletion protection on production databases.
|
|
794
|
+
- Use Multi-AZ deployments for high availability and automated failover.
|
|
795
|
+
- Restrict security group ingress to application subnets only.
|
|
796
|
+
|
|
797
|
+
### 7.4 Lambda
|
|
798
|
+
|
|
799
|
+
- One execution role per function — never share roles.
|
|
800
|
+
- Store secrets in Secrets Manager, reference via environment variable containing ARN.
|
|
801
|
+
- Enable X-Ray tracing for observability.
|
|
802
|
+
- Set function timeout and memory limits appropriately.
|
|
803
|
+
- Use Lambda Powertools for structured logging and security utilities.
|
|
804
|
+
- Pin runtime versions and review dependency vulnerabilities.
|
|
805
|
+
- For function URLs, always use `AuthType AWS_IAM` unless there is a specific,
|
|
806
|
+
documented reason for public access.
|
|
807
|
+
|
|
808
|
+
### 7.5 ECS/EKS
|
|
809
|
+
|
|
810
|
+
- Use Fargate to eliminate host management responsibility where possible.
|
|
811
|
+
- Assign per-task IAM roles (ECS task role, not the EC2 instance role).
|
|
812
|
+
- For EKS, use Pod Identity or IRSA (IAM Roles for Service Accounts).
|
|
813
|
+
- Scan container images with ECR image scanning (Inspector integration).
|
|
814
|
+
- Use private ECR repositories. Enable image tag immutability.
|
|
815
|
+
- Enable GuardDuty EKS Audit Log Monitoring and Runtime Monitoring.
|
|
816
|
+
- Enforce network policies in EKS to restrict pod-to-pod communication.
|
|
817
|
+
- Run containers as non-root users with read-only root filesystems.
|
|
818
|
+
|
|
819
|
+
### 7.6 CloudFront
|
|
820
|
+
|
|
821
|
+
- Use Origin Access Control (OAC) for S3 origins — not the legacy OAI.
|
|
822
|
+
- Enforce minimum TLS 1.2 on viewer connections.
|
|
823
|
+
- Attach WAF web ACL with managed rule groups.
|
|
824
|
+
- Use signed URLs or signed cookies for restricted content.
|
|
825
|
+
- Enable access logging to S3 for analysis.
|
|
826
|
+
- Configure custom error pages to avoid leaking backend information.
|
|
827
|
+
- Set appropriate `Cache-Control` headers to prevent caching of sensitive data.
|
|
828
|
+
|
|
829
|
+
### 7.7 API Gateway
|
|
830
|
+
|
|
831
|
+
- Use IAM authorization, Cognito authorizers, or Lambda authorizers — never leave
|
|
832
|
+
APIs unauthenticated in production.
|
|
833
|
+
- Enable request validation on the API Gateway level.
|
|
834
|
+
- Configure throttling and rate limiting per API key or usage plan.
|
|
835
|
+
- Enable API Gateway access logging to CloudWatch.
|
|
836
|
+
- Use resource policies to restrict access by IP, VPC endpoint, or account.
|
|
837
|
+
- Enable WAF integration for web-facing REST APIs.
|
|
838
|
+
- Use private API endpoints with VPC endpoints for internal services.
|
|
839
|
+
|
|
840
|
+
---
|
|
841
|
+
|
|
842
|
+
## 8. Incident Patterns
|
|
843
|
+
|
|
844
|
+
### 8.1 S3 Data Exposure Detection and Response
|
|
845
|
+
|
|
846
|
+
**Detection signals:**
|
|
847
|
+
- Macie alert: sensitive data (PII, PHI, credentials) found in public bucket.
|
|
848
|
+
- Security Hub finding: `S3.2 — S3 buckets should prohibit public read access`.
|
|
849
|
+
- CloudTrail: `PutBucketAcl` or `PutBucketPolicy` with public access grant.
|
|
850
|
+
- External notification: researcher or media report of exposed data.
|
|
851
|
+
|
|
852
|
+
**Response playbook:**
|
|
853
|
+
1. Immediately block public access: enable S3 Block Public Access on the bucket.
|
|
854
|
+
2. Preserve evidence: snapshot CloudTrail logs, S3 access logs, bucket policy history.
|
|
855
|
+
3. Assess scope: use Macie to classify data in the bucket. Check S3 access logs for
|
|
856
|
+
who accessed the data and when.
|
|
857
|
+
4. Determine exposure window: correlate CloudTrail `PutBucketAcl`/`PutBucketPolicy`
|
|
858
|
+
timestamps with first external access in S3 access logs.
|
|
859
|
+
5. Notify: follow breach notification requirements (GDPR 72 hours, HIPAA 60 days,
|
|
860
|
+
state laws vary).
|
|
861
|
+
6. Remediate root cause: implement S3 Block Public Access at account level via SCP.
|
|
862
|
+
7. Post-incident: add AWS Config rule, update IaC templates, review similar buckets.
|
|
863
|
+
|
|
864
|
+
### 8.2 Credential Compromise Detection and Response
|
|
865
|
+
|
|
866
|
+
**Detection signals:**
|
|
867
|
+
- GuardDuty finding: `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`.
|
|
868
|
+
- GuardDuty finding: `Discovery:IAMUser/AnomalousBehavior`.
|
|
869
|
+
- CloudTrail: API calls from unexpected IP addresses or regions.
|
|
870
|
+
- CloudTrail: `ConsoleLogin` without MFA from unfamiliar location.
|
|
871
|
+
- GitHub/GitGuardian alert: AWS credentials committed to repository.
|
|
872
|
+
|
|
873
|
+
**Response playbook:**
|
|
874
|
+
1. Identify compromised credentials: determine if it is an IAM user key, IAM role
|
|
875
|
+
session, or root credentials.
|
|
876
|
+
2. For IAM user keys: immediately deactivate the access key (do not delete yet —
|
|
877
|
+
needed for forensics). Create a new key if the user needs continued access.
|
|
878
|
+
3. For IAM roles: revoke active sessions by adding a deny-all inline policy with
|
|
879
|
+
a `DateLessThan` condition on `aws:TokenIssueTime`.
|
|
880
|
+
4. Investigate: use CloudTrail to enumerate all API calls made with the compromised
|
|
881
|
+
credentials. Check for new IAM users, roles, policies, EC2 instances, Lambda
|
|
882
|
+
functions, or data exfiltration.
|
|
883
|
+
5. Contain: remove any persistence mechanisms (backdoor IAM users, roles, policies,
|
|
884
|
+
Lambda functions, EC2 instances).
|
|
885
|
+
6. Eradicate: rotate all credentials in the affected account. Review and harden
|
|
886
|
+
IAM policies.
|
|
887
|
+
7. Enable AWS Detective for graph-based investigation of the incident timeline.
|
|
888
|
+
|
|
889
|
+
### 8.3 GuardDuty Findings Response Matrix
|
|
890
|
+
|
|
891
|
+
| Finding Type | Severity | Immediate Action |
|
|
892
|
+
|-----------------------------------------------|----------|---------------------------------------|
|
|
893
|
+
| `Recon:EC2/PortProbeUnprotectedPort` | Low | Review security group, restrict port |
|
|
894
|
+
| `UnauthorizedAccess:EC2/SSHBruteForce` | Medium | Restrict SSH source IPs, use SSM |
|
|
895
|
+
| `CryptoCurrency:EC2/BitcoinTool.B!DNS` | High | Isolate instance, investigate |
|
|
896
|
+
| `Trojan:EC2/BlackholeTraffic` | High | Isolate instance, forensic analysis |
|
|
897
|
+
| `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration` | Critical | Revoke sessions, investigate |
|
|
898
|
+
| `Exfiltration:S3/AnomalousBehavior` | High | Block access, review S3 logs |
|
|
899
|
+
| `Impact:S3/AnomalousBehavior.Permission` | High | Restore bucket policy, investigate |
|
|
900
|
+
| `CredentialAccess:Kubernetes/MaliciousIPCaller`| High | Isolate pod, review RBAC |
|
|
901
|
+
|
|
902
|
+
---
|
|
903
|
+
|
|
904
|
+
## 9. Compliance and Standards
|
|
905
|
+
|
|
906
|
+
### 9.1 CIS AWS Foundations Benchmark
|
|
907
|
+
|
|
908
|
+
The CIS AWS Foundations Benchmark is the most widely adopted AWS security standard.
|
|
909
|
+
AWS Security Hub supports versions 1.2.0, 1.4.0, 3.0.0, and 5.0.0.
|
|
910
|
+
|
|
911
|
+
**Version 5.0.0** (latest, supported since October 2025):
|
|
912
|
+
- 40 automated security controls.
|
|
913
|
+
- Controls organized into Level 1 (basic security, minimal disruption) and Level 2
|
|
914
|
+
(higher security, may impact functionality).
|
|
915
|
+
- Covers IAM, logging, monitoring, networking, and storage.
|
|
916
|
+
|
|
917
|
+
Key control areas:
|
|
918
|
+
- IAM: no root access keys, MFA on root, rotate credentials, no wildcard policies.
|
|
919
|
+
- Logging: CloudTrail in all regions, log file validation, S3 access logging.
|
|
920
|
+
- Monitoring: CloudWatch alarms for unauthorized API calls, root login, IAM changes.
|
|
921
|
+
- Networking: no default VPC usage, restricted security groups, VPC Flow Logs.
|
|
922
|
+
|
|
923
|
+
### 9.2 AWS Well-Architected Security Pillar
|
|
924
|
+
|
|
925
|
+
The Security Pillar covers seven design principles and six best practice areas:
|
|
926
|
+
|
|
927
|
+
**Design Principles:**
|
|
928
|
+
1. Implement a strong identity foundation.
|
|
929
|
+
2. Maintain traceability.
|
|
930
|
+
3. Apply security at all layers.
|
|
931
|
+
4. Automate security best practices.
|
|
932
|
+
5. Protect data in transit and at rest.
|
|
933
|
+
6. Keep people away from data.
|
|
934
|
+
7. Prepare for security events.
|
|
935
|
+
|
|
936
|
+
**Best Practice Areas:**
|
|
937
|
+
1. Security foundations (shared responsibility, account structure, governance).
|
|
938
|
+
2. Identity and access management (human and machine identities).
|
|
939
|
+
3. Detection (logging, monitoring, anomaly detection).
|
|
940
|
+
4. Infrastructure protection (network, compute, edge protection).
|
|
941
|
+
5. Data protection (classification, encryption, backup).
|
|
942
|
+
6. Incident response (preparation, simulation, forensics).
|
|
943
|
+
|
|
944
|
+
### 9.3 SOC 2 on AWS
|
|
945
|
+
|
|
946
|
+
- Map SOC 2 Trust Services Criteria to AWS services and configurations.
|
|
947
|
+
- Use AWS Artifact for SOC 2 compliance reports (AWS's own SOC 2 Type II report).
|
|
948
|
+
- Key controls: CloudTrail (CC6.1 — logical access), Config (CC7.1 — system monitoring),
|
|
949
|
+
GuardDuty (CC6.8 — threat detection), KMS (CC6.1 — encryption).
|
|
950
|
+
- Document shared responsibility clearly — AWS manages physical security, you manage
|
|
951
|
+
logical access, data protection, and application security.
|
|
952
|
+
|
|
953
|
+
### 9.4 PCI-DSS on AWS
|
|
954
|
+
|
|
955
|
+
- Use AWS PCI-DSS compliance package (AWS is a PCI-DSS Level 1 Service Provider).
|
|
956
|
+
- Isolate Cardholder Data Environment (CDE) in a dedicated VPC or account.
|
|
957
|
+
- Encrypt cardholder data at rest (KMS) and in transit (TLS 1.2+).
|
|
958
|
+
- Implement network segmentation between CDE and non-CDE environments.
|
|
959
|
+
- Enable file integrity monitoring on EC2 instances processing cardholder data.
|
|
960
|
+
- Maintain audit trails: CloudTrail (Requirement 10), Config (Requirement 2).
|
|
961
|
+
- Regular vulnerability scanning: Inspector (Requirement 11.2), penetration testing
|
|
962
|
+
(Requirement 11.3).
|
|
963
|
+
|
|
964
|
+
### 9.5 HIPAA on AWS
|
|
965
|
+
|
|
966
|
+
- Sign a Business Associate Agreement (BAA) with AWS — required for HIPAA workloads.
|
|
967
|
+
- Only use HIPAA-eligible AWS services (listed in the BAA).
|
|
968
|
+
- Encrypt all Protected Health Information (PHI) at rest and in transit.
|
|
969
|
+
- Enable CloudTrail logging for all access to PHI.
|
|
970
|
+
- Implement access controls: IAM policies restricting PHI access to authorized roles.
|
|
971
|
+
- Enable Macie to scan S3 for PHI exposure.
|
|
972
|
+
- Use separate accounts or VPCs for PHI workloads.
|
|
973
|
+
- Maintain minimum necessary standard — grant access only to the minimum PHI needed.
|
|
974
|
+
|
|
975
|
+
---
|
|
976
|
+
|
|
977
|
+
## 10. Code Examples
|
|
978
|
+
|
|
979
|
+
### 10.1 CloudTrail Configuration (Terraform)
|
|
980
|
+
|
|
981
|
+
```hcl
|
|
982
|
+
resource "aws_cloudtrail" "main" {
|
|
983
|
+
name = "org-trail"
|
|
984
|
+
s3_bucket_name = aws_s3_bucket.cloudtrail_logs.id
|
|
985
|
+
include_global_service_events = true
|
|
986
|
+
is_multi_region_trail = true
|
|
987
|
+
enable_log_file_validation = true
|
|
988
|
+
enable_logging = true
|
|
989
|
+
kms_key_id = aws_kms_key.cloudtrail.arn
|
|
990
|
+
|
|
991
|
+
cloud_watch_logs_group_arn = "${aws_cloudwatch_log_group.cloudtrail.arn}:*"
|
|
992
|
+
cloud_watch_logs_role_arn = aws_iam_role.cloudtrail_cloudwatch.arn
|
|
993
|
+
|
|
994
|
+
event_selector {
|
|
995
|
+
read_write_type = "All"
|
|
996
|
+
include_management_events = true
|
|
997
|
+
|
|
998
|
+
data_resource {
|
|
999
|
+
type = "AWS::S3::Object"
|
|
1000
|
+
values = ["arn:aws:s3"]
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
insight_selector {
|
|
1005
|
+
insight_type = "ApiCallRateInsight"
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
insight_selector {
|
|
1009
|
+
insight_type = "ApiErrorRateInsight"
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
tags = {
|
|
1013
|
+
Environment = "security"
|
|
1014
|
+
ManagedBy = "terraform"
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
# Dedicated logging bucket with Object Lock
|
|
1019
|
+
resource "aws_s3_bucket" "cloudtrail_logs" {
|
|
1020
|
+
bucket = "org-cloudtrail-logs-${data.aws_caller_identity.current.account_id}"
|
|
1021
|
+
force_destroy = false
|
|
1022
|
+
|
|
1023
|
+
object_lock_enabled = true
|
|
1024
|
+
|
|
1025
|
+
tags = {
|
|
1026
|
+
Purpose = "CloudTrail audit logs"
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
resource "aws_s3_bucket_versioning" "cloudtrail_logs" {
|
|
1031
|
+
bucket = aws_s3_bucket.cloudtrail_logs.id
|
|
1032
|
+
versioning_configuration {
|
|
1033
|
+
status = "Enabled"
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "cloudtrail_logs" {
|
|
1038
|
+
bucket = aws_s3_bucket.cloudtrail_logs.id
|
|
1039
|
+
rule {
|
|
1040
|
+
apply_server_side_encryption_by_default {
|
|
1041
|
+
sse_algorithm = "aws:kms"
|
|
1042
|
+
kms_master_key_id = aws_kms_key.cloudtrail.id
|
|
1043
|
+
}
|
|
1044
|
+
bucket_key_enabled = true
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
### 10.2 IMDSv2 Enforcement (Terraform)
|
|
1050
|
+
|
|
1051
|
+
**Insecure — IMDSv1 allowed (default on older instances):**
|
|
1052
|
+
|
|
1053
|
+
```hcl
|
|
1054
|
+
# BAD: IMDSv1 is enabled by default, vulnerable to SSRF
|
|
1055
|
+
resource "aws_instance" "insecure" {
|
|
1056
|
+
ami = "ami-0abcdef1234567890"
|
|
1057
|
+
instance_type = "t3.micro"
|
|
1058
|
+
# No metadata_options block = IMDSv1 enabled
|
|
1059
|
+
}
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
**Secure — IMDSv2 enforced:**
|
|
1063
|
+
|
|
1064
|
+
```hcl
|
|
1065
|
+
resource "aws_instance" "secure" {
|
|
1066
|
+
ami = "ami-0abcdef1234567890"
|
|
1067
|
+
instance_type = "t3.micro"
|
|
1068
|
+
|
|
1069
|
+
metadata_options {
|
|
1070
|
+
http_endpoint = "enabled"
|
|
1071
|
+
http_tokens = "required" # Forces IMDSv2
|
|
1072
|
+
http_put_response_hop_limit = 1 # Prevents container escape
|
|
1073
|
+
instance_metadata_tags = "disabled"
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
root_block_device {
|
|
1077
|
+
encrypted = true
|
|
1078
|
+
kms_key_id = aws_kms_key.ebs.arn
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
tags = {
|
|
1082
|
+
Name = "secure-instance"
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
### 10.3 GuardDuty with SNS Alerting (Terraform)
|
|
1088
|
+
|
|
1089
|
+
```hcl
|
|
1090
|
+
resource "aws_guardduty_detector" "main" {
|
|
1091
|
+
enable = true
|
|
1092
|
+
|
|
1093
|
+
datasources {
|
|
1094
|
+
s3_logs {
|
|
1095
|
+
enable = true
|
|
1096
|
+
}
|
|
1097
|
+
kubernetes {
|
|
1098
|
+
audit_logs {
|
|
1099
|
+
enable = true
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
malware_protection {
|
|
1103
|
+
scan_ec2_instance_with_findings {
|
|
1104
|
+
ebs_volumes {
|
|
1105
|
+
enable = true
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
# Alert on high-severity findings
|
|
1113
|
+
resource "aws_cloudwatch_event_rule" "guardduty_high" {
|
|
1114
|
+
name = "guardduty-high-severity"
|
|
1115
|
+
description = "Alert on GuardDuty high/critical findings"
|
|
1116
|
+
|
|
1117
|
+
event_pattern = jsonencode({
|
|
1118
|
+
source = ["aws.guardduty"]
|
|
1119
|
+
detail-type = ["GuardDuty Finding"]
|
|
1120
|
+
detail = {
|
|
1121
|
+
severity = [{ numeric = [">=", 7] }]
|
|
1122
|
+
}
|
|
1123
|
+
})
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
resource "aws_cloudwatch_event_target" "sns" {
|
|
1127
|
+
rule = aws_cloudwatch_event_rule.guardduty_high.name
|
|
1128
|
+
target_id = "guardduty-alerts"
|
|
1129
|
+
arn = aws_sns_topic.security_alerts.arn
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
resource "aws_sns_topic" "security_alerts" {
|
|
1133
|
+
name = "security-alerts"
|
|
1134
|
+
kms_master_key_id = aws_kms_key.sns.id
|
|
1135
|
+
}
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
### 10.4 Secure Security Group Pattern (Terraform)
|
|
1139
|
+
|
|
1140
|
+
```hcl
|
|
1141
|
+
# Application Load Balancer — HTTPS only from the internet
|
|
1142
|
+
resource "aws_security_group" "alb" {
|
|
1143
|
+
name = "alb-sg"
|
|
1144
|
+
description = "ALB - HTTPS from internet"
|
|
1145
|
+
vpc_id = aws_vpc.main.id
|
|
1146
|
+
|
|
1147
|
+
ingress {
|
|
1148
|
+
description = "HTTPS"
|
|
1149
|
+
from_port = 443
|
|
1150
|
+
to_port = 443
|
|
1151
|
+
protocol = "tcp"
|
|
1152
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
egress {
|
|
1156
|
+
description = "To application servers"
|
|
1157
|
+
from_port = 8080
|
|
1158
|
+
to_port = 8080
|
|
1159
|
+
protocol = "tcp"
|
|
1160
|
+
security_groups = [aws_security_group.app.id]
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
# Application servers — only from ALB
|
|
1165
|
+
resource "aws_security_group" "app" {
|
|
1166
|
+
name = "app-sg"
|
|
1167
|
+
description = "App servers - from ALB only"
|
|
1168
|
+
vpc_id = aws_vpc.main.id
|
|
1169
|
+
|
|
1170
|
+
ingress {
|
|
1171
|
+
description = "From ALB"
|
|
1172
|
+
from_port = 8080
|
|
1173
|
+
to_port = 8080
|
|
1174
|
+
protocol = "tcp"
|
|
1175
|
+
security_groups = [aws_security_group.alb.id]
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
egress {
|
|
1179
|
+
description = "To database"
|
|
1180
|
+
from_port = 5432
|
|
1181
|
+
to_port = 5432
|
|
1182
|
+
protocol = "tcp"
|
|
1183
|
+
security_groups = [aws_security_group.db.id]
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
egress {
|
|
1187
|
+
description = "To AWS services via VPC endpoints"
|
|
1188
|
+
from_port = 443
|
|
1189
|
+
to_port = 443
|
|
1190
|
+
protocol = "tcp"
|
|
1191
|
+
cidr_blocks = [aws_vpc.main.cidr_block]
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
# Database — only from application servers
|
|
1196
|
+
resource "aws_security_group" "db" {
|
|
1197
|
+
name = "db-sg"
|
|
1198
|
+
description = "Database - from app servers only"
|
|
1199
|
+
vpc_id = aws_vpc.main.id
|
|
1200
|
+
|
|
1201
|
+
ingress {
|
|
1202
|
+
description = "PostgreSQL from app"
|
|
1203
|
+
from_port = 5432
|
|
1204
|
+
to_port = 5432
|
|
1205
|
+
protocol = "tcp"
|
|
1206
|
+
security_groups = [aws_security_group.app.id]
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
egress {
|
|
1210
|
+
description = "No outbound"
|
|
1211
|
+
from_port = 0
|
|
1212
|
+
to_port = 0
|
|
1213
|
+
protocol = "-1"
|
|
1214
|
+
cidr_blocks = []
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
### 10.5 AWS Config Compliance Rules (Terraform)
|
|
1220
|
+
|
|
1221
|
+
```hcl
|
|
1222
|
+
resource "aws_config_config_rule" "s3_public_read" {
|
|
1223
|
+
name = "s3-bucket-public-read-prohibited"
|
|
1224
|
+
source {
|
|
1225
|
+
owner = "AWS"
|
|
1226
|
+
source_identifier = "S3_BUCKET_PUBLIC_READ_PROHIBITED"
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
resource "aws_config_config_rule" "iam_no_admin" {
|
|
1231
|
+
name = "iam-policy-no-admin-access"
|
|
1232
|
+
source {
|
|
1233
|
+
owner = "AWS"
|
|
1234
|
+
source_identifier = "IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESS"
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
resource "aws_config_config_rule" "encrypted_volumes" {
|
|
1239
|
+
name = "encrypted-volumes"
|
|
1240
|
+
source {
|
|
1241
|
+
owner = "AWS"
|
|
1242
|
+
source_identifier = "ENCRYPTED_VOLUMES"
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
resource "aws_config_config_rule" "imdsv2" {
|
|
1247
|
+
name = "ec2-imdsv2-check"
|
|
1248
|
+
source {
|
|
1249
|
+
owner = "AWS"
|
|
1250
|
+
source_identifier = "EC2_IMDSV2_CHECK"
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
resource "aws_config_config_rule" "cloudtrail_enabled" {
|
|
1255
|
+
name = "multi-region-cloudtrail-enabled"
|
|
1256
|
+
source {
|
|
1257
|
+
owner = "AWS"
|
|
1258
|
+
source_identifier = "MULTI_REGION_CLOUD_TRAIL_ENABLED"
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
resource "aws_config_config_rule" "rds_encrypted" {
|
|
1263
|
+
name = "rds-storage-encrypted"
|
|
1264
|
+
source {
|
|
1265
|
+
owner = "AWS"
|
|
1266
|
+
source_identifier = "RDS_STORAGE_ENCRYPTED"
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
resource "aws_config_config_rule" "root_mfa" {
|
|
1271
|
+
name = "root-account-mfa-enabled"
|
|
1272
|
+
source {
|
|
1273
|
+
owner = "AWS"
|
|
1274
|
+
source_identifier = "ROOT_ACCOUNT_MFA_ENABLED"
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
```
|
|
1278
|
+
|
|
1279
|
+
---
|
|
1280
|
+
|
|
1281
|
+
## References
|
|
1282
|
+
|
|
1283
|
+
- AWS Well-Architected Security Pillar: https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html
|
|
1284
|
+
- CIS AWS Foundations Benchmark: https://www.cisecurity.org/benchmark/amazon_web_services
|
|
1285
|
+
- AWS Security Best Practices Whitepaper: https://docs.aws.amazon.com/whitepapers/latest/aws-security-best-practices/welcome.html
|
|
1286
|
+
- IAM Security Best Practices: https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
|
|
1287
|
+
- Capital One Breach Analysis: https://krebsonsecurity.com/2019/08/what-we-can-learn-from-the-capital-one-hack/
|
|
1288
|
+
- Capital One Breach (ACM): https://dl.acm.org/doi/full/10.1145/3546068
|
|
1289
|
+
- Twitch Data Breach: https://thehackernews.com/2021/10/twitch-suffers-massive-125gb-data-and.html
|
|
1290
|
+
- AWS IMDSv2 Defense: https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/
|
|
1291
|
+
- Prowler: https://github.com/prowler-cloud/prowler
|
|
1292
|
+
- ScoutSuite: https://github.com/nccgroup/ScoutSuite
|
|
1293
|
+
- Steampipe: https://steampipe.io/
|
|
1294
|
+
- Checkov: https://www.checkov.io/
|
|
1295
|
+
- Datadog State of Cloud Security 2024: https://www.datadoghq.com/state-of-cloud-security/
|
|
1296
|
+
- Qualys IMDSv1 Research: https://blog.qualys.com/vulnerabilities-threat-research/2024/09/12/totalcloud-insights-unmasking-aws-instance-metadata-service-v1-imdsv1-the-hidden-flaw-in-aws-security
|