TOKEN=$(curl -X PUT "http://169.254.169" \ -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") Use code with caution.
In the past (IMDSv1), metadata was accessible via a simple GET request. While convenient, this was vulnerable to attacks. If an attacker could trick a web application into making a request to that internal IP, they could steal sensitive IAM credentials.
. These credentials were like a skeleton key to the rest of the AWS kingdom. The Birth of the Token My Hands-On with AWS EC2 Instance Metadata Service
Use firewall rules (security groups) to block outbound traffic to 169.254.169.254 from non-admin instances. But note: this may break legitimate cloud-init processes.
"eventName": "GetObject", "sourceIPAddress": "169.254.169.254", "userAgent": "curl/7.68.0", "errorCode": "AccessDenied"
TOKEN=$(curl -X PUT "http://169.254.169" \ -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") Use code with caution.
In the past (IMDSv1), metadata was accessible via a simple GET request. While convenient, this was vulnerable to attacks. If an attacker could trick a web application into making a request to that internal IP, they could steal sensitive IAM credentials.
. These credentials were like a skeleton key to the rest of the AWS kingdom. The Birth of the Token My Hands-On with AWS EC2 Instance Metadata Service
Use firewall rules (security groups) to block outbound traffic to 169.254.169.254 from non-admin instances. But note: this may break legitimate cloud-init processes.
"eventName": "GetObject", "sourceIPAddress": "169.254.169.254", "userAgent": "curl/7.68.0", "errorCode": "AccessDenied"