The 169.254.169.254 Problem: How One SSRF Bug Exposed 100 Million Capital One Customers
A misconfigured ModSecurity web application firewall on an EC2 instance could be tricked into relaying requests to the AWS metadata endpoint, returning temporary IAM credentials. The attacker used those credentials to list and copy data from many S3 buckets, exposing data of about 100 million people.
Read here.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
In March 2019 an attacker sent a crafted request to a web application firewall running on an AWS EC2 instance at Capital One. The firewall forwarded the request to an address that only exists inside AWS: [redacted]. What came back were temporary AWS credentials. A few steps later, the attacker was copying data out of S3.
The breach affected roughly 100 million people in the US and about 6 million in Canada, including around 140,000 Social Security numbers and 80,000 linked bank account numbers. No zero-day was involved, and no malware either. It was a chain of three ordinary mistakes, and each link is still common in production today.

A misconfigured firewall, an over-permissioned role, and a metadata endpoint every cloud engineer should know by heart.
Setup
Every EC2 instance can query a link-local HTTP endpoint at [redacted] to learn about itself: its instance ID, region, user data, and, if an IAM role is attached, temporary credentials for that role.
# From inside an EC2 instance (IMDSv1)
curl http://[redacted]/latest/meta-data/iam/security-credentials/
# -> prints the role name
curl http://[redacted]/latest/meta-data/iam/security-credentials/<role-name>
# -> returns AccessKeyId, SecretAccessKey, Token
This is by design. It means applications never need hardcoded keys. The assumption is that only code running on the instance can reach it. That assumption breaks if you can make the instance send an HTTP request on your behalf.
Finding it
Server-Side Request Forgery (SSRF) is when an attacker tricks a server into making a request to a destination of the attacker's choosing. The server's network position becomes the attacker's: internal services, localhost, and metadata endpoints are all reachable.
Public reporting on the case, including the US Department of Justice's complaint, describes a misconfigured open-source web application firewall (ModSecurity) on an EC2 instance. The WAF could be coaxed into relaying requests to the metadata endpoint and returning the response. The attacker never needed a foothold on the box. The WAF fetched the credentials and handed them back.
Exploitation
Step 1: SSRF through the WAF
The attacker sent a crafted request to the web application firewall. The firewall forwarded it to [redacted], and the response, temporary AWS credentials, came back to the attacker.
Step 2: IMDSv1 answers without friction
The original metadata service (IMDSv1) answered any plain GET request. No token, no header, no handshake. Any SSRF primitive that could issue a simple GET was enough, which is why the relay above worked.
AWS launched IMDSv2 in November 2019, after this breach became public. It requires a session token obtained with a PUT request and then passed in a header on each call:
[redacted] -X PUT "http://[redacted]/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -H "X-aws-ec2-metadata-token: $TOKEN" \
http://[redacted]/latest/meta-data/iam/security-credentials/
This defeats most SSRF cases, because typical SSRF bugs let the attacker control a URL but not the HTTP method or headers. It also rejects requests that carry an X-Forwarded-For header, which catches many proxy-style relays.
Step 3: Using the stolen role
With the stolen credentials, the attacker could call the AWS API as the WAF's role. Court documents say that role could list and read a large number of S3 buckets. A WAF has no reason to read customer data stores. The attacker then listed the buckets and used sync to copy their contents out. The role's permissions turned a small bug into a mass data theft.
Root cause
Three layers each had a gap:
- Input handling in the WAF: it could be coaxed into relaying requests to the metadata endpoint and returning the response.
- A metadata service with no friction: IMDSv1 answered any plain GET, so any SSRF primitive that could issue a simple GET was enough.
- An IAM role with excessive power: the WAF's role could list and read a large number of S3 buckets.
Fixing any one of them would have reduced or prevented the damage. SSRF gave the attacker a way in; over-broad IAM permissions determined how much damage followed.
Impact
The attacker listed the buckets and used sync to copy their contents out.
Capital One faced an $80 million penalty from the OCC and a class action settlement of $190 million. The attacker, a former AWS engineer named Paige Thompson, was convicted in 2022 on wire fraud and unauthorized access charges.
The company learned about the intrusion from an outside tip months after it began. Nothing in its monitoring flagged an unusual role pulling large volumes from S3.
Fix
- Enforce IMDSv2. For EC2, set
HttpTokens=requiredon instances, and set the account or launch template defaults so new instances inherit it. Also set the hop limit to 1 where containers on the host don't need metadata access, so a container can't reach it through the host.
aws ec2 modify-instance-metadata-options \
--instance-id i-0123456789abcdef0 \
--http-tokens required \
--http-put-response-hop-limit 1
Audit with AWS Config or Security Hub. Both have rules for IMDSv1 usage.
- Treat any server-side fetch as an SSRF surface. Webhooks, URL previews, image fetchers, PDF renderers, and import-from-URL features all qualify. Defences that hold up:
- Allowlist destination hosts instead of blocklisting bad ones.
- Resolve DNS yourself and check the resulting IP against private, loopback, and link-local ranges before connecting, and pin that IP to prevent DNS rebinding.
- Don't follow redirects blindly, since a redirect can bounce you to an internal address.
- Block egress from the app tier to
[redacted]with host firewall rules if the app doesn't need it.
-
Scope IAM like you mean it. Each role should hold only the actions and resources the workload needs. A web-facing component with
s3:*on*is an incident waiting for a trigger. Use IAM Access Analyzer to find unused permissions and generate least-privilege policies from CloudTrail activity. -
Detect credential misuse. Temporary credentials issued to an instance should be used from that instance. Alert when they're used from elsewhere. GuardDuty has findings for instance credentials being used from outside AWS or from a different account. Also alert on unusual
ListBucketscalls and unusually large S3 reads by roles that don't normally do either. -
Keep the same logic for other clouds. GCP and Azure have equivalent metadata endpoints, and GCP's requires a
Metadata-Flavor: Googleheader, which blocks the same simple SSRF pattern. The principle holds everywhere: a metadata service reachable by a plain request is a credential vending machine.
Variants to test
- Any internet-facing service that fetches a user-supplied URL. Test it with the metadata IP and
localhost. - Instances still allowing IMDSv1. Check which of your instances still allow it.
- The role on your most exposed instance. Run it through IAM Access Analyzer to see what it can do.
- Detection coverage. Ask whether anyone would notice if that role listed every bucket tomorrow.
Hunting notes
When you review architecture, ask what an attacker gets if a single component is tricked into making one request, and make sure the answer isn't "everything." The detection story is its own lesson: the company learned about the intrusion from an outside tip months after it began, and nothing in its monitoring flagged an unusual role pulling large volumes from S3.
What happened, in plain words
In March 2019, someone sent a specially crafted request to a piece of software that Capital One, a large bank, was running on computers rented from Amazon. That software was a web application firewall. Its job is to sit in front of a website and inspect incoming traffic, a bit like a security guard at a door who checks everyone's bag before letting them in.
This guard had a flaw. It could be talked into walking to a private address inside Amazon's network and bringing back whatever it found there. The address was [redacted]. What it found was a set of temporary keys that let whoever held them act as part of Capital One's systems inside Amazon.
A few steps later, the attacker was copying files out of S3, which is Amazon's online storage service, the equivalent of a very large shared drive in the cloud. The breach affected roughly 100 million people in the US and about 6 million in Canada, including around 140,000 Social Security numbers and 80,000 linked bank account numbers.
No zero-day was involved, and no malware either. A zero-day is a flaw nobody knew about before it was used; malware is malicious software planted on a machine. Neither happened here. It was a chain of three ordinary mistakes, and each link is still common in production today.

A misconfigured firewall, an over-permissioned role, and a metadata endpoint every cloud engineer should know by heart.
The link everyone should understand: the metadata service
Before the mistakes, you need one piece of background: what a metadata service is.
When you rent a computer from Amazon, you get a virtual machine. Amazon calls this an EC2 instance. "Instance" just means one running copy of a computer. It has no screen and no keyboard; you reach it over the network.
Every such instance can ask a special address, [redacted], questions about itself: what is my instance ID (my name tag), which region am I in (which data centre area), and what setup instructions was I given when I started. This address is called a link-local address. It is a link-local address, and the assumption is that only code running on the instance can reach it. Think of it as a phone number that only works inside one building.
The most important thing the instance can ask for is a set of temporary credentials, if an IAM role is attached to it. An IAM role is a set of permissions, a list of what this computer is allowed to do in Amazon's systems. Credentials are the proof that you are allowed: a username-and-password equivalent for software. "Temporary" means they expire after a while, like a visitor badge that stops opening doors at the end of the day.
Here is how an instance asks for them:
# From inside an EC2 instance (IMDSv1)
curl http://[redacted]/latest/meta-data/iam/security-credentials/
# -> prints the role name
curl http://[redacted]/latest/meta-data/iam/security-credentials/<role-name>
# -> returns AccessKeyId, SecretAccessKey, Token
Line by line:
- The first line is a comment. Anything after
#is a note for humans and is ignored by the computer. It says these commands are meant to be run from inside an EC2 instance, using the older version of the metadata service, called IMDSv1. curlis a command-line tool that fetches a web address, like a browser without a window. The address it fetches ishttp://[redacted]/latest/meta-data/iam/security-credentials/. That path is a question: "which role is attached to me?"- The next comment says the answer is the role's name, a short label such as a job title.
- The second
curluses that name in the address, replacing<role-name>with whatever the first command printed. This is a second question: "now give me the keys for that role." - The final comment says the answer contains three things: an AccessKeyId (a public identifier for the key, like a username), a SecretAccessKey (the secret half, like a password), and a Token (an extra piece that proves the credentials are temporary).
This is by design. It means applications never need hardcoded keys, meaning passwords written directly into the program's files, where they are easy to leak. The assumption is that only code running on the instance can reach this address.
That assumption breaks if you can make the instance send an HTTP request on your behalf. An HTTP request is simply a message one computer sends another asking for something, the same kind of message your browser sends when you open a page. If you can make someone else's computer send that message for you, you can make it ask questions you are not allowed to ask yourself.
Link 1: SSRF
Server-Side Request Forgery (SSRF) is when an attacker tricks a server into making a request to a destination of the attacker's choosing. A server is the computer that answers when your browser asks for a page. Normally it only fetches things it decided to fetch. SSRF means you get to decide instead.
The server's network position becomes the attacker's. That is the key idea. The server sits inside a private network, so it can reach internal services, its own localhost (the machine talking to itself), and metadata endpoints, all of which are unreachable from outside. It is like convincing a receptionist to make a phone call for you to a number you cannot dial yourself, then reading you the answer.
Public reporting on the case, including the US Department of Justice's complaint, describes a misconfigured open-source web application firewall (ModSecurity) on an EC2 instance. ModSecurity is free software that inspects web traffic and blocks suspicious requests. The WAF could be coaxed into relaying requests to the metadata endpoint and returning the response. The attacker never needed a foothold on the box, meaning no login, no shell, no access to the machine itself. The WAF fetched the credentials and handed them back.
Link 2: IMDSv1 had no friction
The original metadata service (IMDSv1) answered any plain GET request. GET is the simplest kind of HTTP request: "give me this page". No token, no header, no handshake. A header is an extra line of information attached to a request, such as "I am sending this from a phone". A handshake is a short back-and-forth before the real conversation, like showing ID at a desk before being let in.
Any SSRF primitive that could issue a simple GET was enough. A primitive here means a basic building block of an attack: one small ability, such as "make the server fetch a URL". If that was all you had, it was all you needed.
AWS launched IMDSv2 in November 2019, after this breach became public. It requires a session token obtained with a PUT request and then passed in a header on each call. A session token is a short-lived pass proving you completed the first step. PUT is a different kind of HTTP request, normally used to send data rather than just ask for it.
[redacted] -X PUT "http://[redacted]/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -H "X-aws-ec2-metadata-token: $TOKEN" \
http://[redacted]/latest/meta-data/iam/security-credentials/
Line by line:
[redacted] means: run the command inside the brackets and store its output in a variable calledTOKEN`. A variable is a named box that holds a value for later use.curl -X PUTsends a request of type PUT rather than the default GET. The address is/latest/api/token, the endpoint that issues session tokens.-H "X-aws-ec2-metadata-token-ttl-seconds: 21600"adds a header saying how long the token should stay valid: 21600 seconds, which is six hours. TTL stands for time to live.- The backslash at the end of the line means "the command continues on the next line"; it is only there for readability.
- The second
curlasks the same question as before, for the role name, but now adds-H "X-aws-ec2-metadata-token: $TOKEN". The$TOKENis replaced by the value saved in step 1. Without that header, the request is refused.
This defeats most SSRF cases, because typical SSRF bugs let the attacker control a URL but not the HTTP method or headers. If all you can do is say "fetch this address", you cannot perform the PUT step or attach the token header, so you never get past the door. It also rejects requests that carry an X-Forwarded-For header, which catches many proxy-style relays. That header is normally added by a proxy, a middleman that forwards traffic, to record where the request originally came from; its presence suggests the request was relayed rather than made directly by the instance.
Link 3: A role that could do far too much
With the stolen credentials, the attacker could call the AWS API as the WAF's role. An API is the set of commands one program offers to another, like a service counter with a fixed menu: you can ask for the things on the list, and nothing else. Here the menu was Amazon's, and the credentials said "I am the WAF, let me in".
Court documents say that role could list and read a large number of S3 buckets. A bucket is a container in S3, like a folder at the top level of a shared drive. A WAF has no reason to read customer data stores. Its job is to inspect incoming web traffic, not to open the filing cabinets behind it.
The attacker then listed the buckets and used sync to copy their contents out. sync is an AWS command that copies files between two places and keeps them matching; pointed at an empty destination, it simply copies everything. The role's permissions turned a small bug into a mass data theft.
This is the lesson to take from the incident. SSRF gave the attacker a way in. Over-broad IAM permissions determined how much damage followed. If the guard had been able to open only the front door, the stolen badge would have been far less useful.
How it was discovered
The attacker, a former AWS engineer named Paige Thompson, did not hide well. She reportedly discussed the data in online channels and posted about it on GitHub, a website where people share code and project notes. A tipster saw this and emailed Capital One's responsible disclosure address in July 2019. A responsible disclosure address is a published contact for reporting security problems to a company.
Capital One confirmed the intrusion, involved the FBI, and she was arrested within days. She was convicted in 2022 on wire fraud and unauthorized access charges. Capital One faced an $80 million penalty from the OCC and a class action settlement of $190 million. The OCC is a US bank regulator; a class action is a lawsuit brought by many affected people together.
The detection story is its own lesson. The company learned about the intrusion from an outside tip months after it began. Nothing in its monitoring flagged an unusual role pulling large volumes from S3. Monitoring means the automated watching of systems for odd behaviour; here it stayed silent while a role that should never have touched customer files read them in bulk.
What to do on your own infrastructure
1. Enforce IMDSv2. For EC2, set HttpTokens=required on instances, and set the account or launch template defaults so new instances inherit it. A launch template is a saved recipe used to create new instances, so setting the default there means every future machine starts with the safer setting. Also set the hop limit to 1 where containers on the host don't need metadata access, so a container can't reach it through the host. A container is a lightweight, isolated environment for running software on a shared machine; the hop limit counts how many network steps a request may take, and a limit of 1 stops a container from reaching the metadata address through the machine hosting it.
aws ec2 modify-instance-metadata-options \
--instance-id i-0123456789abcdef0 \
--http-tokens required \
--http-put-response-hop-limit 1
Line by line:
aws ec2 modify-instance-metadata-optionsis the AWS command-line tool being asked to change the metadata settings of an EC2 instance.--instance-id i-0123456789abcdef0names which instance to change. The value is a placeholder identifier in the usual format.--http-tokens requiredsays requests to the metadata service must carry a token, which means IMDSv2 only.--http-put-response-hop-limit 1sets the hop limit to 1, so a container cannot reach the metadata service through the host where containers do not need metadata access.
Audit with AWS Config or Security Hub. Both have rules for IMDSv1 usage. Auditing means checking your systems against a list of expectations; these two AWS services can do that check for you and point out instances still using the old, frictionless version.
2. Treat any server-side fetch as an SSRF surface. A surface is any place where an attacker can interact with your system. Webhooks, URL previews, image fetchers, PDF renderers, and import-from-URL features all qualify. A webhook is an automatic message one service sends another when something happens; a URL preview is the little card that appears when you paste a link into a chat; an image fetcher downloads a picture from a link; a PDF renderer turns a web page into a document; import-from-URL lets a user pull data in from an address they supply. Each of these makes your server fetch an address someone else chose, which is exactly the SSRF situation.
Defences that hold up:
- Allowlist destination hosts instead of blocklisting bad ones. An allowlist is a list of things that are permitted, and everything else is refused; a blocklist is the opposite, and it always misses something.
- Resolve DNS yourself and check the resulting IP against private, loopback, and link-local ranges before connecting, and pin that IP to prevent DNS rebinding. DNS is the internet's address book, turning names into numeric IP addresses. Rebinding is a trick where a name resolves to a harmless address when you check it and a dangerous one when you connect; pinning means you keep using the address you already checked.
- Don't follow redirects blindly, since a redirect can bounce you to an internal address. A redirect is a server's reply saying "the thing you want is over there", and "over there" can be somewhere private.
- Block egress from the app tier to
[redacted]with host firewall rules if the app doesn't need it. Egress means outbound traffic; the app tier is the layer of your system that serves users; a host firewall is a filter on the machine itself.
3. Scope IAM like you mean it. Each role should hold only the actions and resources the workload needs. A web-facing component with s3:* on * is an incident waiting for a trigger. In that notation, s3:* means every S3 action and * means every resource, so the role can do anything to everything in storage. Use IAM Access Analyzer to find unused permissions and generate least-privilege policies from CloudTrail activity. CloudTrail is AWS's log of who did what and when; least privilege means giving each role the smallest set of permissions that still lets it work.
4. Detect credential misuse. Temporary credentials issued to an instance should be used from that instance. Alert when they're used from elsewhere. GuardDuty has findings for instance credentials being used from outside AWS or from a different account. GuardDuty is AWS's built-in threat detection service, and a finding is its report of something suspicious. Also alert on unusual ListBuckets calls and unusually large S3 reads by roles that don't normally do either. ListBuckets is the API call that asks "what buckets exist?", the first thing someone does when they are about to rummage through storage.
5. Keep the same logic for other clouds. GCP and Azure have equivalent metadata endpoints, and GCP's requires a Metadata-Flavor: Google header, which blocks the same simple SSRF pattern. GCP is Google Cloud Platform and Azure is Microsoft's cloud; both rent computers the way AWS does, and both give those computers a way to ask about themselves. The principle holds everywhere: a metadata service reachable by a plain request is a credential vending machine. Put in a coin, meaning one ordinary request, and out comes a set of keys.
A quick self-audit
- Can any of your internet-facing services fetch a user-supplied URL? Test it with the metadata IP and
localhost. Internet-facing means reachable from the public internet;localhostis the machine's own name for itself, another address that should never be reachable from outside. - Which of your instances still allow IMDSv1?
- What can the role on your most exposed instance do? Run it through IAM Access Analyzer.
- Would anyone notice if that role listed every bucket tomorrow?
The takeaway
This breach wasn't a failure of one control. Three layers each had a gap: input handling in the WAF, a metadata service with no friction, and an IAM role with excessive power. Fixing any one of them would have reduced or prevented the damage.
When you review architecture, ask what an attacker gets if a single component is tricked into making one request, and make sure the answer isn't "everything."
Glossary
- API: the fixed menu of commands one program offers to another, so software can ask for things without a human clicking.
- AWS: Amazon Web Services, Amazon's cloud platform where you rent computers and storage over the internet.
- Azure: Microsoft's cloud platform, a competitor to AWS.
- Bucket: a top-level container in S3, like a folder on a shared drive, that holds files.
- Class action: a lawsuit brought by many affected people together as one case.
- CloudTrail: AWS's log recording who did what in an account and when.
- Container: a lightweight, isolated environment for running software on a shared machine.
- Credentials: the proof that software is allowed to act, roughly a username and password for programs.
- curl: a command-line tool that fetches a web address, like a browser without a window.
- DNS: the internet's address book, turning names into numeric IP addresses.
- DNS rebinding: a trick where a name points to a harmless address when checked and a dangerous one when actually used.
- EC2 instance: one running virtual computer rented from AWS.
- Egress: outbound network traffic leaving a system.
- Endpoint: a specific address on a server that answers a particular kind of request.
- GET: the simplest kind of HTTP request, meaning "give me this page".
- GCP: Google Cloud Platform, Google's cloud platform.
- GuardDuty: AWS's built-in threat detection service, which reports suspicious activity as findings.
- Header: an extra line of information attached to an HTTP request or response, such as a content type or a token.
- Hop limit: a count of how many network steps a request may take before it is dropped.
- HTTP request: a message one computer sends another asking for something, the same kind your browser sends when you open a page.
- IAM: Identity and Access Management, AWS's system for defining who and what may do which actions.
- IAM Access Analyzer: an AWS tool that reviews permissions and helps build least-privilege policies.
- IAM role: a named set of permissions that a computer or program can be given, instead of a fixed password.
- IMDSv1: the original AWS metadata service, which answered any plain GET request with no token.
- IMDSv2: the newer AWS metadata service, which requires a session token obtained with a PUT request and sent as a header.
- Instance ID: the unique name tag of one EC2 instance.
- IP address: the numeric address of a computer on a network.
- Launch template: a saved recipe AWS uses to create new instances with preset settings.
- Least privilege: giving each role only the smallest set of permissions it needs to do its job.
- Link-local address: an address that only works inside one machine or local network, not from the internet.
- localhost: the name a machine uses for itself.
- Malware: malicious software planted on a machine to cause harm.
- Metadata service: a special address an instance can ask about itself, including for temporary credentials.
- ModSecurity: a free, open-source web application firewall that inspects web traffic.
- Monitoring: automated watching of systems for unusual behaviour.
- OCC: a US regulator for banks, the Office of the Comptroller of the Currency.
- Primitive: a basic building block of an attack, one small ability such as making a server fetch a URL.
- Proxy: a middleman that forwards network traffic on someone else's behalf.
- PUT: an HTTP request type normally used to send data rather than just ask for it.
- Redirect: a server's reply saying the requested thing is at another address.
- Region: a geographic area containing AWS data centres.
- S3: Amazon's online storage service, a very large shared drive in the cloud.
- Server: the computer that answers when your browser asks for a page.
- Session token: a short-lived pass proving you completed an earlier step, such as the PUT in IMDSv2.
- SSRF: Server-Side Request Forgery, tricking a server into fetching an address of the attacker's choosing.
- sync: an AWS command that copies files between two places and keeps them matching.
- TTL: time to live, how long something such as a token stays valid.
- Variable: a named box in a command that holds a value for later use.
- WAF: web application firewall, software that sits in front of a website and inspects incoming traffic.
- Webhook: an automatic message one service sends another when something happens.
- Zero-day: a flaw nobody knew about before it was used in an attack.