Cloud misconfiguration lab

An AWS environment in Terraform with four deliberate security flaws. One variable, harden, flips every resource between vulnerable and hardened, so the same scanners can measure the difference.

2026
  • AWS
  • Terraform
  • Prowler
  • ScoutSuite
  • Python
  • Bash
View source

What one variable changes, resource by resourceFrom the Terraform source

Resourceharden = false · vulnerableharden = true · hardened

S3 buckets3.tf

vulnerable

  • ACL public-read
  • Public access block off
  • No default encryption
  • Versioning suspended

hardened

  • ACL private
  • All 4 public access blocks on
  • Server-side encryption on
  • Versioning enabled

IAM policyiam.tf

vulnerable

  • Action "*"
  • Resource "*"

hardened

  • s3:GetObject, s3:ListBucket
  • One bucket ARN only

Security groupnetwork.tf

vulnerable

  • tcp/22 from 0.0.0.0/0

hardened

  • tcp/22 from trusted_cidr only

EBS snapshotebs.tf

vulnerable

  • Shared publicly
  • Volume unencrypted

hardened

  • Public share removed
  • Volume encrypted

Threat mapping

Each flaw tied to the CIS AWS Foundations Benchmark area it breaks and the ATT&CK technique it enables.

MisconfigurationCIS areaATT&CKWhat an attacker gets
Public S3 bucketS3 public access, encryptionT1530Reads the bucket anonymously
Wildcard IAM policyIAM least privilegeT1078.004One leaked credential becomes full admin
SSH open to the internetSecurity group ingressT1133A login prompt reachable from anywhere
Public EBS snapshotStorage sharing, exposureT1530Restores the disk in their own account

Scan, harden, re-scan

The same two scanners run against both states, and a script compares the reports.

  1. Deploy vulnerablebaseline stateharden=false
  2. ScanProwler + ScoutSuiterun_prowler.sh
  3. Hardensame resources, fixedharden=true
  4. Re-scansame checksrun_scoutsuite.sh
  5. Comparewhich findings closed, which remaincompare_reports.py
  6. Tear downand verify nothing is leftverify_teardown.sh

Cost guardrail

An AWS Budgets alarm emails at 80% and 100% of a monthly limit, so a forgotten lab can’t run up a bill. The limit is a variable, $5 by default.

Monthly AWS Budgets limit, from budget.tf.