AWS

Introduction

Nowadays, it is pretty common that applications are being executed inside cloud environments like Amazon Web Service (AWS). In this section, you will learn some techinques that will help you to enumerate your environment.

Profile Configuration

aws configure --profile $profile
aws configure set aws_session_token "" --profile $profile

Enumeration Commands

Caller identity

Enumeration Commandsarrow-up-right

aws sts get-caller-identity --query 'Arn' --output text --profile $profile
aws iam get-user --profile $profile
# If you only have a Key ID
aws sts get-access-key-info --access-key-id=ASIA1234567890123456

IAM

Policies

Enumeration Commandsarrow-up-right

Roles

Secrets

Enumeration Commandsarrow-up-right

KMS

Enumeration Commandsarrow-up-right

S3

Enumeration Commandsarrow-up-right

EC2

Enumeration Commandsarrow-up-right

LightSail - Database

Enumeration Commandsarrow-up-right

RDS

Enumeration Commandsarrow-up-right

Lambda

Enumeration Commandsarrow-up-right

EFS

Enumeration Commandsarrow-up-right

DynamoDB

Enumeration Commandsarrow-up-right

ECR

Source arrow-up-right& Post-Exploitationarrow-up-right

ECS

Enumeration Commandsarrow-up-right

ElasticBeanStalk

Enumeration Commandsarrow-up-right

Codebuild

Enumeration Commandsarrow-up-right

SQS

Enumeration Commandsarrow-up-right

SNS

Enumeration Commandsarrow-up-right

Cognito

Enumeration Commandsarrow-up-right

Schedulers

Enumeration Commandsarrow-up-right

API Gateway

Enumeration Commandsarrow-up-right

Step Functions

Enumeration Commandsarrow-up-right

SSRF inside AWS

Enumeration Commandsarrow-up-right

If you can perform an SSRF attack inside an AWS EC2 instance, container, lambda function or elastik server, you can retrieve its temporal credentials.

EC2 Creds - IMDSv1 || Elastic Beanstalk

EC2 Creds - IMDSv2

EC2 User-data

Lambda

Containers metadata

Tools

Pentesting/Red Teaming:

Audit related

  • cloudfoxarrow-up-right: An offensive security tool for penetration testers to discover exploitable attack paths and gain situational awareness in unfamiliar cloud environments.

  • ScoutSuitearrow-up-right: A multi-cloud security auditing tool that automates the collection of configuration data and generates an HTML report highlighting security risks.

  • tfstate2IAMarrow-up-right: A Python tool that parses Terraform state files in S3 buckets to extract IAM entities (users, roles, policies), providing insight into permissions without requiring direct IAM read access.

Red Team Tips

Cloud Trail Bypasses

Bypass Detectionarrow-up-right

EKS Post Exploitationarrow-up-right

Discovering Canary Tokens

The best way to identify canary tokens without triggering an alerts is by adding that token to a profile and perform requests against a resource outside of the attacking organization. Example:

As a result, you can see that that user might be some canary token.

Last updated