Yes—AWS IAM privilege escalation is one of the most common cloud attack paths, and in most real-world accounts you will find at least one exploitable chain. The safe way to discover yours is to attack a dedicated sandbox account using Pacu for exploitation and CloudGoat for intentionally vulnerable scenarios—then close each path with least-privilege IAM design.
Traditional penetration testing follows a well-established playbook: scan, exploit, pivot. Attacking an AWS account throws most of that out the window. There is no network perimeter to breach in the classic sense—identity is the perimeter. And in IAM, a single over-permissive policy statement can turn a low-privilege developer into a full account administrator without touching a single EC2 instance. If you’re not actively hunting these paths in your own account, assume someone else eventually will.
TL;DR: Can You Escalate Privileges in Your Own AWS Account? Yes—Here’s How to Find Out Safely
Absolutely, and you should assume the answer is yes until proven otherwise. IAM misconfigurations—wildcard permissions on iam:* actions, unconditioned iam:PassRole, modifiable policy versions—create escalation chains that Rhino Security Labs has catalogued in detail. The workflow in this guide: stand up a sandboxed AWS account, deploy CloudGoat’s vulnerable scenarios, run Pacu’s reconnaissance and iam__privesc_scan modules, capture CloudTrail evidence, then apply the blue-team fixes that eliminate each path. Total lab cost is near zero if you tear down properly.
What Is IAM Privilege Escalation in AWS?
IAM privilege escalation is the process of moving from a limited set of permissions to broader ones—typically administrator-level access—using only the permissions you already have. Unlike traditional escalation, which exploits software vulnerabilities, AWS escalation exploits permission combinations. Your starting access might look harmless: read-only-ish IAM access, ability to launch an EC2 instance, permission to update a Lambda function. Any of these can be a stepping stone.
The canonical reference here is Rhino Security Labs’ research, which documented 23 escalation methods in 2018 and shipped Pacu as the open-source exploitation framework to match. Their research underpins both the attack tooling and, frankly, most of the industry’s understanding of IAM attack paths. AWS’s own IAM Access Analyzer now surfaces some of these misconfigurations—but tooling is no substitute for actually testing what an attacker can do.
Why it matters: an attacker who compromises a single developer credential—a leaked key in a public GitHub repo, a phished session token—rarely stops at that developer’s access. Escalation paths are how a minor incident becomes a full account takeover, cryptomining bills in the tens of thousands, or data exfiltration from S3.
Lab Setup: Isolating a Sandbox AWS Account
Do not run any of this against production. Ever. Pacu’s modules make real IAM changes—attaching policies, modifying trust relationships, backdooring roles. Build the lab like this:
- Create a dedicated AWS account under AWS Organizations, isolated from any production or staging accounts. Name it something unambiguous like
pentest-lab. - Set billing alarms immediately. AWS Budgets with an alert at $5 and $20, plus a CloudWatch billing alarm. This is your circuit breaker.
- Never use production credentials. No shared keys, no copied
~/.aws/credentialsprofiles. Generate fresh IAM users or SSO sessions scoped strictly to the lab account. - Enable CloudTrail with an organization trail writing to a dedicated S3 bucket, with log file validation on. CloudTrail is both your evidence source and your detection foundation later in this guide.
- Enable GuardDuty and IAM Access Analyzer in the lab account from day one—you’ll want to observe what they catch during the exercise.
CISA’s cloud security guidance and NIST SP 800-210 both emphasize exactly this pattern: test in isolated environments with full audit logging, never against shared infrastructure.
Installing and Configuring Pacu
Pacu is an open-source AWS exploitation framework, originally developed by Rhino Security Labs and now community-maintained. It’s the closest thing the cloud world has to Metasploit for IAM. Install it on a Linux attack box:
git clone https://github.com/RhinoSecurityLabs/pacu.git
cd pacu
python3 -m pip install -r requirements.txt
python3 pacu.py
On first launch, Pacu prompts you for a session name—it tracks all your findings, loot, and executed modules per session. Then import your lab credentials:
set-keys
Pacu will ask for the AWS access key ID, secret key, and optionally a session token. Use a dedicated lab key with the intentionally vulnerable permissions—CloudGoat scenarios provision these for you. Key Pacu modules to know:
iam__enum_users_roles_policies_groups— full IAM reconnaissanceiam__privesc_scan— the headline act; tests all documented escalation techniquesiam__backdoor_assume_role— modifies a role’s trust policy to grant your user accessiam__attach_user_policy— attachesAdministratorAccessto your compromised userec2__startup_user_data— exfiltrates instance metadata via modified user data
Deploying CloudGoat Vulnerable Scenarios
CloudGoat, also from Rhino Security Labs, is Rhino’s “vulnerable by design” AWS deployment tool—the cloud equivalent of DVWA or Metasploitable. It uses Terraform to provision deliberately misconfigured environments you can legally attack. Install and deploy:
git clone https://github.com/RhinoSecurityLabs/cloudgoat.git
cd cloudgoat
pip install -r core/requirements.txt
./cloudgoat.py config whitelist --your-ip
./cloudgoat.py create iam_privesc_by_rollback
Two scenarios worth running for this exercise:
iam_privesc_by_rollback— provisions a user who can modify policy versions. The default policy version is benign; a previous version grants admin. Rolling back “restores” administrative access. This is a brilliantly realistic scenario—version history in IAM policies is an audit artifact attackers actively mine.ec2_ssrf— an SSRF-vulnerable web app on EC2 that leaks instance metadata, yielding role credentials you then escalate. This mirrors real-world exploits like the Capital One breach, where an SSRF flaw exposed IMDSv1 credentials at massive scale.
CloudGoat outputs the starting credentials after each create. Save them—you’ll feed these into Pacu next.
Recon with Pacu: Mapping IAM Permissions
Escalation starts with knowing exactly what you have. In Pacu:
whoami
run iam__enum_users_roles_policies_groups
run iam__enum_permissions
whoami confirms your identity context—user ARN, account ID, permission boundaries. The enumeration modules pull users, roles, groups, attached and inline policies, then download and parse every policy document to build a permission map. Pacu flags escalation candidates automatically in its output, but read the policies yourself. You’re looking for statements like:
{
"Effect": "Allow",
"Action": ["iam:CreatePolicyVersion", "iam:SetDefaultPolicyVersion"],
"Resource": "*"
}
That combination is game over—it means the user can write a new policy version granting * on * and set it as default. Similar red flags: any iam:Update*, iam:Attach*, iam:Put*, or sts:AssumeRole on roles with more privilege than yours.
Running the Escalation: iam__privesc_scan and Technique Walkthroughs
Now the main event:
run iam__privesc_scan
Pacu enumerates all documented Rhino techniques, checks which ones your current permissions permit, and offers to auto-exploit. Confirm each technique with yes or run them selectively. In the iam_privesc_by_rollback scenario, the path works like this:
- Pacu identifies
iam:CreatePolicyVersionandiam:SetDefaultPolicyVersionas available. - It creates a new policy version allowing
action: *, resource: *. - It sets that version as the default—your user now has full admin.
Alternatively, exploit the non-destructive rollback path: list the policy’s versions with aws iam list-policy-versions, find the old admin-granting version, and call iam:SetDefaultPolicyVersion to roll back. In other scenarios, Pacu may propose iam__attach_user_policy (straightforwardly attaching AdministratorAccess) or iam__backdoor_assume_role, which edits a target role’s trust policy to add your user as a trusted principal—a stealthier technique because role assumption leaves a less obvious trail than direct policy modification.
Verifying Escalation and Capturing Evidence
Verify you’re admin:
aws iam get-user
aws sts get-caller-identity
aws iam list-users
If list-users and other account-wide reads succeed from a formerly limited identity, escalation is confirmed. For the report:
- Screenshot Pacu’s module output—it logs the exact API calls and success confirmations per session.
- Query CloudTrail for the attack window: filter event names
CreatePolicyVersion,SetDefaultPolicyVersion,AttachUserPolicy,UpdateAssumeRolePolicy. Note which events your alarm configuration would have caught—and which it wouldn’t. - Record timestamps and source IPs so blue-teamers can map the chain end-to-end in their SIEM.
Blue-Team Fixes: Closing Each Escalation Path
Every escalation technique maps to a specific preventive control:
- Kill wildcard IAM write permissions. No developer identity needs
iam:CreatePolicyVersion,iam:SetDefaultPolicyVersion,iam:UpdateAssumeRolePolicy, oriam:AttachUserPolicy. If a pipeline requires one, scope it to specific policy/role ARNs—not"Resource": "*". - Condition
iam:PassRoleaggressively. Pair it withiam:PassedToServiceconditions and restrict which roles can be passed. Unconditioned PassRole plus any compute-launch permission equals escalation. - Never grant
iam:UpdatePolicyor policy-write wildcards to humans. Policy changes belong in version-controlled IaC pipelines with code review, not console access. - Enforce SCP guardrails. Service Control Policies at the organization level can flatly deny dangerous IAM actions even if account-level policies misconfigure them. Deny
iam:PutUserPolicy,iam:CreatePolicyVersion, and role trust modifications outside your IaC role. - Move to IMDSv2 (require token-based metadata access via
HttpTokens: required) to eliminate the SSRF-to-credentials class of attack entirely. - Enforce least privilege with Access Analyzer policy generation, then right-size manually. OWASP’s serverless and cloud guidance reinforces the same principle: scope every identity to the minimum viable permission set.
Continuous Detection: CloudTrail Alarms and IAM Access Analyzer
Prevention fails eventually; detection is your backstop. Detect escalation attempts in CloudTrail by alerting on these API calls from unusual principals:
CreatePolicyVersion/SetDefaultPolicyVersion— policy rollback and overwrite attacksAttachUserPolicy/AttachRolePolicy— especially when attachingAdministratorAccessUpdateAssumeRolePolicy— trust policy backdooringCreateAccessKey— called by a principal on another userLoginProfilecreation for users that never had console access
Implement these as Amazon EventBridge rules routing to SNS, or as managed detections in GuardDuty—GuardDuty’s Persistence:IAMUser/NetworkPermissions and related findings catch several of these automatically. Enable IAM Access Analyzer to continuously flag external trust relationships and unused permissions, and generate least-privilege policies from CloudTrail activity.
Finally, make it a cadence: re-run this Pacu exercise quarterly, after major IAM changes, and as part of new-service onboarding. Escalation paths creep back the moment engineers start granting permissions to unblock themselves—they always do.
Cleanup: Tearing Down CloudGoat Safely
Vulnerable infrastructure left running is a real liability—CloudGoat scenarios are exploitable by design, and you created backdoored IAM objects during testing. Tear down completely:
./cloudgoat.py destroy iam_privesc_by_rollback
Then verify manually, because Terraform doesn’t always catch everything:
- Check
aws iam list-users,list-roles, andlist-policies --scope Localfor leftover CloudGoat objects; delete orphaned policies and profiles by hand. - Deactivate and delete all lab access keys; revoke Pacu sessions with
aws iam delete-access-key. - Confirm the billing dashboard shows no unexpected resources, and check the Cost Explorer for anomalies.
- Delete the lab SSM parameters, secrets, and any EC2 instances or Lambda functions the scenarios created.
Your CloudTrail history stays—that’s the point. The attack evidence, the escalation chain, and the fixes become your internal playbook. Attack your own account before someone else does it for you, on their terms.
Frequently Asked Questions
Is it legal to run Pacu against an AWS account?
Only against accounts you own or have explicit written authorization to test. Attacking an AWS account without authorization violates the CFAA and equivalent laws in most jurisdictions, plus AWS’s Acceptable Use Policy. Always use a dedicated sandbox account, and get sign-off in writing for anything beyond your own lab.
What are the most common IAM privilege escalation techniques?
Per Rhino Security Labs’ documented list: policy version creation/rollback, iam:AttachUserPolicy, iam:PassRole abuse with compute services, role trust policy manipulation, and creating access keys for other users. Pacu’s iam__privesc_scan implements the full catalogue.
How much does the CloudGoat lab cost to run?
Mostly free-tier or pennies—most scenarios use IAM objects and small compute resources. The risk is forgotten resources, so set AWS Budgets alarms at $5 and $20 and run cloudgoat destroy the moment you finish.
How do I prevent IAM privilege escalation in production?
Least privilege everywhere, SCP guardrails denying dangerous IAM write actions, no wildcard permissions on iam:* actions, IMDSv2 required on all instances, IAM Access Analyzer enabled, and CloudTrail alerting on policy-modification API calls. Then verify with periodic Pacu testing.
