The EC2 Instance Metadata Service (IMDS) endpoint at 169.254.169.254 returns IAM role credentials to any process running on an EC2 instance that can make an HTTP request — including web application code exploited via SSRF (Server-Side Request Forgery). Capital One's breach exploited exactly this: an SSRF vulnerability in a WAF allowed the attacker to query the metadata endpoint and retrieve credentials. IMDSv2 requires a session token obtained through a PUT request, which SSRF attacks cannot easily forge. Enforce IMDSv2 on all EC2 instances using the instance metadata options. For containers, apply iptables rules to block access to 169.254.169.254 from container network namespaces.
Tags