Résumé

In 2019, a former Amazon engineer stole the personal data of about 100 million Americans from Capital One, and she did it through a chain of cloud-security mistakes that has since become a teaching classic. A misconfigured web application firewall could be tricked into making requests on the attacker's behalf, a flaw called server-side request forgery. She pointed it at a special internal address that every AWS server can reach, the one that hands out the server's temporary cloud credentials, grabbed those credentials, and because they were far more powerful than they needed to be, used them to download Capital One's data straight out of its storage. It is the textbook SSRF-to-cloud-takeover chain, and the reason AWS hardened that metadata service afterward.

How it happened

The attack was a clean four-link chain. First, a misconfigured ModSecurity web application firewall running on an AWS EC2 instance was vulnerable to server-side request forgery (SSRF): it could be tricked into making a web request to a URL of the attacker's choosing. Second, the attacker pointed that request at the EC2 Instance Metadata Service at 169.254.169.254, a special link-local address every EC2 instance can query to retrieve the temporary credentials of its attached IAM role. Third, the SSRF returned those credentials. Fourth, the firewall's IAM role was badly over-privileged, with broad access to Capital One's S3 storage, so the stolen credentials let the attacker list and download the data and exfiltrate it. The intrusion happened over 22-23 March 2019. Paige Thompson, a former AWS engineer who knew this pattern well, was arrested on 29 July 2019, and the breach was not caught by Capital One's defences at all: Thompson had posted the stolen data to a public GitHub gist under her own name, and an outside researcher tipped off the bank.

The damage

Roughly 100 million people in the US and 6 million in Canada were exposed, mostly credit-card application data (names, addresses, credit scores), including about 140,000 US Social Security numbers, 80,000 linked bank-account numbers, and around 1 million Canadian Social Insurance Numbers. Capital One paid an $80 million regulatory fine (the OCC's, for failing to manage the risk of its cloud migration) and a $190 million class-action settlement. Prosecutors established that Thompson had used the same SSRF technique against more than 30 organisations, planting cryptomining software on the servers she breached; a jury convicted her of wire fraud and computer-fraud charges in June 2022 (acquitting her of identity theft), and she was sentenced to time served and probation. The breach directly motivated AWS to release IMDSv2 in November 2019, a hardened version of the metadata service that requires a session token and limits network hops, designed to break exactly this SSRF-reads-credentials pattern.

Why Capital One still matters

It is the canonical cloud SSRF chain, and a least-privilege lesson. Every link was independently breakable: the SSRF (validate and block outbound requests to the metadata address), the metadata service (IMDSv2 requires a token an SSRF cannot easily obtain), and the over-privileged role (least privilege would have sharply limited the damage even after the credentials were stolen). The defences: enforce IMDSv2 with a hop limit of one, scope EC2 instance roles to least privilege and never grant broad S3 access, block SSRF at the application and egress layers, enable S3 Block Public Access with encryption and alerting on large reads, and watch for instance credentials being used from outside the instance, the dead giveaway. It shares the cloud-credential-theft theme with the provider-side ChaosDB flaw.

Comment le corriger

  • Enforce IMDSv2 and revoke and rotate the exposed instance-role credentials immediately; assume anything the role could read was taken.
  • Tighten the firewall and app to block SSRF and deny access to the metadata endpoint, and scope the IAM role to least privilege.
  • Review CloudTrail for the stolen credentials' use and quantify exactly what was exfiltrated.

Comment l’éviter

  • Enforce IMDSv2 (require session tokens, set the hop limit to 1) so an SSRF cannot read instance role credentials.
  • Scope EC2 instance IAM roles to least privilege; never grant broad S3 list/get across all buckets.
  • Block SSRF at the app and egress layers: validate and allowlist outbound URLs and deny access to 169.254.169.254.
  • Enable S3 Block Public Access and encrypt sensitive data; alert on large or unusual S3 reads.
  • Monitor CloudTrail and GuardDuty for instance credentials used from outside the instance or for anomalous API calls.

Références

Vulnérabilités liées

Tout Infra →