Curl-url-http-3a-2f-2f169.254.169.254-2flatest-2fapi-2ftoken
169.254.0.0/16 is the link-local address range (IPv4). These addresses are not routable on the internet — they are designed for communication within a single network segment.
Cloud providers reserve 169.254.169.254 for their instance metadata service. From inside a virtual machine (EC2 instance in AWS, Compute Engine VM in GCP, Virtual Machine in Azure), you can query this IP to get information about the instance itself without needing any external credentials.
The IP address 169.254.169.254 is a link-local address that is used by cloud providers to offer a metadata service to instances (virtual machines) they manage. This service provides instances with information about themselves, such as their current state, the instance ID, the region they're running in, and more. curl-url-http-3A-2F-2F169.254.169.254-2Flatest-2Fapi-2Ftoken
The use of 169.254.169.254 specifically is standardized across various cloud platforms for their instance metadata services. It works because this IP address is not routable and thus can only be accessed by the instance itself, providing a mechanism for the instance to learn about its environment.
You could request:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/some-role
And it would directly return IAM credentials in plaintext. No authentication, no token, no headers. Any process on the VM — including a compromised web application — could get admin keys.
Set --http-put-response-hop-limit 1 so that containers or proxies cannot forward metadata requests. And it would directly return IAM credentials in plaintext
Do not assign overly permissive roles to EC2 instances. Use role-specific permissions and rotate credentials automatically.
169.254.169.254 is a link-local IP address used by major cloud providers (AWS, Google Cloud, Azure, and others) to serve instance metadata. This metadata includes: In AWS IMDSv2 (the latest version), the workflow is:
In AWS IMDSv2 (the latest version), the workflow is:
However, the simplified command in your keyword:
curl http://169.254.169.254/latest/api/token — only fetches the token, not the credentials themselves. Still, in a real attack, once the attacker has this token, they can use it to fetch IAM credentials.