back to top

Curl-url-http-3a-2f-2f169.254.169.254-2flatest-2fapi-2ftoken: ((install))

#!/bin/bash # safe_metadata.sh – Retrieve metadata with IMDSv2

Amazon Web Services (AWS) provides a metadata service that allows instances to retrieve information about themselves. This service is accessible via a special URL, typically http://169.254.169.254/latest/meta-data/ . The metadata service provides a range of information, including instance ID, type, and IP address. One of the most critical uses of this service is to retrieve temporary security credentials, which can be used to access other AWS resources.

Once you have a token, you can use it to retrieve metadata:

The raw string is a URL-encoded version of a standard system administration command. When you decode the special characters, the structure becomes clear: decodes to a colon ( : ) 2F decodes to a forward slash ( / )

metadata_get() local path="$1" local token=$(get_token) curl -s -H "X-aws-ec2-metadata-token: $token" "http://169.254.169.254/latest/$path" curl-url-http-3A-2F-2F169.254.169.254-2Flatest-2Fapi-2Ftoken

The keyword you see is simply a version of the command:

You can no longer access metadata directly. You must first request a session token via an HTTP PUT request.

Then they export the keys and assume the IAM role from their own machine.

The string you provided is a URL-encoded command used to retrieve an IMDSv2 (Instance Metadata Service Version 2) session token One of the most critical uses of this

This article provides a comprehensive guide on using curl http://169.254.169.254/latest/api/token to authenticate and secure your metadata requests in 2026. What is 169.254.169.254?

The URL-encoded string refers to the AWS EC2 Instance Metadata Service (IMDSv2) token endpoint, which requires a PUT request to generate a session token for secure metadata retrieval. This command is legitimate for administrative tasks but may indicate an SSRF attack attempt if observed in unexpected logs. For more details, visit AWS documentation . EC2 Instance Meta Data Service version 2 (IMDSv2) - GitHub

Because this IP is link-local, the traffic never leaves the virtual machine. It cannot be accessed from the public internet. The Evolution: IMDSv1 vs. IMDSv2

This command requests a cryptographic token from a unique, non-routable IP address. This address is accessible only from within an isolated cloud server. What is 169.254.169.254? You must first request a session token via

Modern firewalls and applications often strip out or block unrecognized custom headers. By requiring specific headers for both token creation and token usage, AWS leverages existing network defenses to block unauthorized access attempts. Migration and Enforcement Best Practices

The keyword refers to the curl command used to retrieve a session token from the Amazon Web Services (AWS) Instance Metadata Service Version 2 (IMDSv2) .

Every EC2 instance has a built‑in, non‑routable metadata service accessible at the IP address 169.254.169.254 . This service provides the instance with information about itself – such as instance ID, AMI ID, hostname, security groups, IAM role credentials, and much more.

: The instance sends an HTTP PUT request to the metadata endpoint.

This mechanism fundamentally changes the security model from a "open-by-default" to an "opt-in verification" model. A standard curl request to retrieve the token resembles the following: