The address 169.254.169.254 is a used by Amazon Web Services (AWS) to provide the Instance Metadata Service (IMDS) . Every EC2 instance can "talk" to this IP to learn about itself without needing an external internet connection.
Attackers don’t magically run curl on your instance. They need to inject this HTTP request into a context that runs on the target machine. The most common methods are: The address 169
On Linux instances, you can use iptables or nftables to restrict access to 169.254.169.254 . For example, allow only the root user or a specific process: They need to inject this HTTP request into
If your application never needs to call AWS APIs, you can disable the metadata service entirely: The address 169
The URL http://169.254.169.254/latest/meta-data/iam/security-credentials/ is used by AWS EC2 instances to fetch temporary security credentials from the AWS Instance Metadata Service.
print(creds["AccessKeyId"], creds["SecretAccessKey"], creds["Token"])
| Provider | Metadata IP / Endpoint | |----------|------------------------| | AWS | http://169.254.169.254/latest/meta-data/ | | Azure | http://169.254.169.254/metadata/instance?api-version=2017-08-01 (requires header Metadata: true ) | | GCP | http://metadata.google.internal/computeMetadata/v1/ (requires header Metadata-Flavor: Google ) | | DigitalOcean | http://169.254.169.254/metadata/v1/ | | Alibaba Cloud | http://100.100.100.200/latest/meta-data/ |