Cloud Security Office Hours Banner

Recreate the Capital One breach in your lab

Build the vulnerable architecture (WAF + SSRF-able service + IMDSv1 + over-privileged role), exploit it, then build the controls and detections that close it.

Walkthrough All Portfolio Projects

· · Vendor-neutral · View source on GitHub

Time: ~12 hours  ·  Difficulty: Advanced  ·  Stack: AWS · Terraform · WAF · IAM · GuardDuty

Recreating a real breach end-to-end is the single most compelling portfolio piece in cloud security. The 2019 Capital One breach is the canonical AWS choice — the kill chain is well-documented, every step maps to a control you can demonstrate, and most cloud security engineers can pattern-match on it instantly.

The artifact is a public repo that, given an AWS account, will deploy the vulnerable setup, walk you through the exploit, then deploy the fixes — all via Terraform. Hiring managers will remember this one.

📖 On this page

  1. What you'll have at the end
  2. Prerequisites
  3. Step-by-step
  4. What hiring managers look for
  5. Common mistakes
  6. Where to publish
  7. Where next

What you'll have at the end

Prerequisites

Step-by-step

1. Re-read the breach in detail

Read the CSOH kill chain, the DOJ indictment, and the AWS official statement. Make a four-step diagram on paper: ingress → SSRF → IMDS → S3 exfil.

2. Terraform the vulnerable architecture

Deploy: VPC with public subnet, EC2 instance running a deliberately-SSRF-vulnerable web app (a one-line Python Flask app that does requests.get(request.args['url'])), the EC2 instance launched with http_tokens = optional (IMDSv1 allowed), an instance profile with overly-broad S3 read/list across multiple buckets, and three S3 buckets with sample data.

Important: this code is intentionally vulnerable. Comment that loudly in the repo's top-level README, and add an automatic teardown script.

3. Execute the exploit

From your laptop, hit the SSRF endpoint to fetch http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>. You should get back temporary credentials. Use aws configure with those creds, then aws s3 ls across the buckets. Screenshot every step.

4. Capture the CloudTrail of your own attack

Pull the CloudTrail events your exploit generated. Note: the IMDS call itself doesn't show in CloudTrail — only the subsequent sts:AssumeRole (if any) and the S3 calls do. This is itself a teaching moment about the limits of AWS detection.

5. Now build the fixes — one at a time

Walk through the Capital One root causes and Terraform a fix per cause:

6. Re-run the exploit against the fixed architecture

Try the SSRF again. With IMDSv2 enforced, the simple SSRF can't get credentials (it needs to PUT first to get a session token). With the WAF rule, the request is blocked at the edge. Document each "now blocked" outcome with a screenshot.

7. Validate detection

Use Stratus Red Team or your own CloudTrail queries to confirm GuardDuty + CloudTrail surface the original attack pattern when run against the fixed architecture. Map findings to MITRE ATT&CK Cloud.

8. Write the kill chain in your own voice

Use our kill chain template as inspiration but write it as your own analysis, with your own diagrams, your own commands, and the lessons you took from doing it hands-on.

9. Tear down (immediately)

This lab leaves nothing useful running. terraform destroy the moment the write-up is recorded.

What hiring managers look for

Common mistakes

Where to publish

The full publishing playbook is on the portfolio hub page. The short version: a public GitHub repo with a thorough README is the strongest single signal; pair it with a LinkedIn post and (optionally) a 5-minute lightning talk at a CSOH Friday Zoom.

Where next