Menu

1 / 3

One GET Request, Full AWS Access: How Attackers Steal EC2 Credentials (and How IMDSv2 Stops Them)

DEV Community: devsecops·Kenneth Chinedu·3 days ago
#BmfZOicQ
#devtodevsecops#devto#dev#instance#role
Long article (1916 words) — no AI summary yet.
Reading 0:00
15s threshold

SSRF, the EC2 metadata service and stolen IAM role credentials: an AWS incident response playbook for revoking sessions, isolating the instance and hardening security groups, so the next request gets a polite no.

Every EC2 instance with an IAM role has a little service sitting at 169.254.169.254 . Ask it for credentials and it gives you some. That's its job. It's the reason your app doesn't need access keys in a config file.

The catch is who's allowed to ask. On an instance still running IMDSv1, the answer is anyone who can get the box to make an HTTP GET. It's the colleague who reads out the office door code to anyone who rings and says "it's me".

How the attacker got the keys

The instance ran a web app with a "fetch this URL for me" feature. Link previews, import from URL, that sort of thing. Nobody had thought much about which URLs it would fetch.

Photo by Jefferson Santos on Unsplash

That's SSRF, server-side request forgery.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.