AWS
Introduction
Profile Configuration
aws configure --profile $profile
aws configure set aws_session_token "" --profile $profileAssume Role
# Assume the role
aws sts assume-role \
--role-session-name "PostExploitSession" \
--profile $profile \
--role-arn "" > /tmp/post_creds.json
# Export to environment variables
## JQ
export AWS_ACCESS_KEY_ID=$(jq -r '.Credentials.AccessKeyId' /tmp/post_creds.json)
export AWS_SECRET_ACCESS_KEY=$(jq -r '.Credentials.SecretAccessKey' /tmp/post_creds.json)
export AWS_SESSION_TOKEN=$(jq -r '.Credentials.SessionToken' /tmp/post_creds.json)
## Python
export AWS_ACCESS_KEY_ID=$(python3 -c 'import json; print(json.load(open("/tmp/post_creds.json"))["AccessKeyId"])')
export AWS_SECRET_ACCESS_KEY=$(python3 -c 'import json; print(json.load(open("/tmp/post_creds.json"))["SecretAccessKey"])')
export AWS_SESSION_TOKEN=$(python3 -c 'import json; print(json.load(open("/tmp/post_creds.json"))["Token"])')
# Update the AWS CLI profile configuration
aws configure set aws_access_key_id "$AWS_ACCESS_KEY_ID" --profile $profile
aws configure set aws_secret_access_key "$AWS_SECRET_ACCESS_KEY" --profile $profile
aws configure set aws_session_token "$AWS_SESSION_TOKEN" --profile $profile
aws configure set region us-east-1 --profile $profile
aws configure set output json --profile $profile
Enumeration Commands
Caller identity
IAM
Policies
Roles
Secrets
KMS
S3
EC2
LightSail - Database
RDS
Lambda
EFS
DynamoDB
ECR
ECS
ElasticBeanStalk
Codebuild
SQS
SNS
Cognito
Schedulers
API Gateway
Step Functions
SSRF inside AWS
Tools
Red Team Tips
Cloud Trail Bypasses
Discovering Canary Tokens
Last updated