Do not use without both written authorization from the cloud account owner AND compliance with the cloud provider's penetration testing policy (AWS requires no prior approval for most services; Azure and GCP require notification or approval for certain test types).
Enumerate the cloud environment to map the attack surface:
AWS Enumeration:
aws sts get-caller-identity - Verify current identity and accountaws iam list-users - List all IAM usersaws iam list-roles - List all IAM roles and their trust policiesaws s3 ls - List all S3 bucketsaws ec2 describe-instances --region us-east-1 - List EC2 instancesaws lambda list-functions - List Lambda functionsaws rds describe-db-instances - List RDS databasesrun iam__enum_permissions, run iam__enum_users_roles_policies_groups
Azure Enumeration:
az account list - List subscriptionsaz ad user list - List Azure AD usersaz vm list - List virtual machinesaz storage account list - List storage accountsaz keyvault list - List key vaultsaz webapp list - List web applicationsCross-Cloud:
scout aws --profile <profile> or scout azure --cli
prowler aws
Test IAM policies for privilege escalation paths:
AWS IAM Escalation:
aws iam get-user-policy, aws iam list-attached-user-policies
iam:CreatePolicyVersion - Create a new policy version granting admin accessiam:SetDefaultPolicyVersion - Set an older, more permissive policy version as defaultiam:PassRole + lambda:CreateFunction + lambda:InvokeFunction - Create a Lambda with a high-privilege roleiam:AttachUserPolicy - Attach AdministratorAccess to the current usersts:AssumeRole - Assume a higher-privilege role if trust policy allowsrun iam__privesc_scan
Azure Identity Escalation:
az role assignment list --assignee <user>
Test cloud storage services for data exposure:
aws s3 ls s3://<bucket> --no-sign-request
aws s3api get-bucket-acl --bucket <bucket>
aws s3api get-bucket-policy --bucket <bucket>
aws s3api list-object-versions --bucket <bucket>
Test compute resources for vulnerabilities:
http://169.254.169.254/latest/meta-data/iam/security-credentials/ to extract IAM role credentialsaws lambda get-function --function-name <name>) and review for hardcoded credentials, insecure dependencies, and injection vulnerabilitiesaws ec2 describe-instance-attribute --instance-id <id> --attribute userData to find credentials in startup scriptsTest network controls for misconfigurations:
| Term | Definition |
|---|---|
| IAM Privilege Escalation | Exploiting overly permissive IAM policies to elevate from limited access to administrative control over the cloud account |
| Instance Metadata Service (IMDS) | An HTTP endpoint (169.254.169.254) on cloud instances that provides instance configuration and IAM role credentials, exploitable via SSRF |
| Assumed Role | An IAM role that a user or service temporarily assumes to gain its permissions, governed by trust policies that define who can assume the role |
| SCPs (Service Control Policies) | Organization-level policies in AWS Organizations that set permission boundaries for accounts, overriding IAM policies |
| Managed Identity | Azure's equivalent of AWS IAM roles for services, providing automatic credential management for Azure resources |
| Resource Policy | Access control policy attached to a cloud resource (S3 bucket, Lambda function, SQS queue) that defines cross-account and public access |
Context: A SaaS company hosts its entire platform on AWS across 3 accounts (production, staging, development). The tester is given read-only IAM credentials in the development account. The goal is to determine if the development account can be used to pivot to production.
Approach:
Pitfalls:
## Finding: Cross-Account Role Trust Allows Development-to-Production Pivot
**ID**: CLOUD-002
**Severity**: Critical (CVSS 9.6)
**Cloud Provider**: AWS
**Affected Account**: Production (111222333444)
**Exploited From**: Development (555666777888)
**Description**:
The production account IAM role "ProdDataAccess" has a trust policy that allows
the Lambda execution role "LambdaDevRole" in the development account to assume
it. This cross-account trust, combined with the developer's ability to modify
Lambda function code, creates a path from development read-only access to
production data access.
**Attack Chain**:
1. Enumerate Lambda functions in dev: aws lambda list-functions
2. Identify LambdaDevRole has sts:AssumeRole permission
3. Modify Lambda to assume ProdDataAccess: aws sts assume-role --role-arn arn:aws:iam::111222333444:role/ProdDataAccess
4. From assumed role: aws s3 ls s3://prod-customer-data -> 2.3 million customer records
**Impact**:
An attacker compromising any developer credential can access production
customer data (2.3 million records) without directly attacking the production
account.
**Remediation**:
1. Restrict the ProdDataAccess trust policy to specific production roles only
2. Remove sts:AssumeRole from the LambdaDevRole policy
3. Implement AWS Organizations SCPs to prevent cross-account role assumption from development
4. Enable CloudTrail alerts for cross-account AssumeRole events
5. Encrypt S3 bucket with KMS key that the development account cannot access