Skip to content
Pwnversity
CLOUD-IAMadvanced · 6 min · upd. 2026-10

IAM Abuse and Privilege Escalation

OWASP A01:2025

In the cloud, IAM (Identity and Access Management) is the system that decides who can do what. It’s, in effect, the new perimeter: compromising an identity with the right permissions equals being an administrator. Cloud privilege escalation rarely exploits a bug: it chains legitimate, misassigned permissions to go from a limited identity to full control of the account. It’s the heart of cloud pentesting.

IAM policies are complex and it’s easy to over-grant. Certain permissions, however innocuous they look, let you grant yourself more privileges: create users, attach policies, assume roles, modify functions that run with privileged roles. The attacker controlling an identity hunts for those “escalation permissions” and chains them up to admin. There’s no exploit: it’s all legitimate API calls, which makes them stealthy if logging isn’t audited.

flowchart LR
    A[Limited identity] --> B{Escalation permission?}
    B -->|iam:AttachUserPolicy| C[Attach AdministratorAccess]
    B -->|iam:PassRole + RunInstances| D[EC2 with admin role -> IMDS]
    B -->|iam:PassRole + CreateFunction| E[Lambda as admin role]
    B -->|sts:AssumeRole| F[Assume privileged role]
    C --> G[Account admin]
    D --> G
    E --> G
    F --> G

Before escalating, you must know exactly what the current identity allows:

Ventana de terminal
# AWS: who am I and what permissions do I have?
aws sts get-caller-identity
aws iam get-account-authorization-details # if allowed
enumerate-iam --access-key AKIA... --secret-key ... # brute-force of permissions
# escalation-path mapping tools
# Pacu (iam__privesc_scan), cloudsplaining, PMapper

Escalation permissions in AWS (the classics)

Section titled “Escalation permissions in AWS (the classics)”

Rhino Security Labs catalogued ~20 paths. The most common:

  • iam:CreateAccessKey → create a key for ANOTHER user (admin).
  • iam:AttachUserPolicy / iam:PutUserPolicy → attach AdministratorAccess to yourself.
  • iam:CreatePolicyVersion → rewrite a policy you’re bound to.
  • iam:PassRole + ec2:RunInstances → launch EC2 with an admin role and use its IMDS.
  • iam:PassRole + lambda:CreateFunction → function running as an admin role.
  • sts:AssumeRole → assume a more privileged role (if the trust policy allows).
  • iam:UpdateAssumeRolePolicy → modify who can assume a role.

Direct example: with iam:AttachUserPolicy on yourself, you attach AdministratorAccess → admin.

Ventana de terminal
aws iam attach-user-policy \
--user-name me \
--policy-arn arn:aws:iam::aws:policy/AdministratorAccess

iam:PassRole lets you “pass” a role to a service (EC2, Lambda, ECS…). If you can pass an admin role to a function or instance you control, you execute code as that role. A policy granting PassRole without scoping the resource is a door to escalation:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["iam:PassRole", "lambda:CreateFunction", "lambda:InvokeFunction"],
"Resource": "*"
}
]
}

With that you create a Lambda running as an admin role, or launch an EC2 and steal its credentials via IMDS (see Metadata Service (IMDS)).

  • Azure: roles with Microsoft.Authorization/roleAssignments/write → assign yourself Owner; abuse of Managed Identities, Automation Accounts, and app consent. Tools: AzureHound, ROADtools, MicroBurst (see Azure Pentesting).
  • GCP: iam.serviceAccounts.getAccessToken / actAs → impersonate a privileged SA; setIamPolicy → grant yourself roles; abuse of Cloud Functions/Compute with an admin SA (see GCP Pentesting).
  1. Enumerate identity and permissions (sts/az/gcloud + enumerate-iam).
  2. Hunt for escalation permissions (Pacu / PMapper / cloudsplaining).
  3. Identify the shortest path to admin.
  4. Execute the escalation (attach policy, pass role, assume role, impersonate).
  5. Confirm privileges and document impact.
  • Real least privilege: no *:*, review dangerous permissions (iam:*, broad PassRole/AssumeRole).
  • Access analyzers: AWS IAM Access Analyzer, cloudsplaining, PMapper — detect escalation paths before the attacker.
  • Separate service roles and scope trust policies (who can AssumeRole/actAs).
  • Permission boundaries and SCPs (AWS) / conditions (Azure/GCP) to cap the maximum scope.
  • Logging (CloudTrail) and alerts on sensitive IAM actions (AttachPolicy, CreateAccessKey, PassRole, UpdateAssumeRolePolicy).
  • Enumerate identity and permissions (sts/az/gcloud + enumerate-iam)
  • Hunt for escalation permissions (Pacu/PMapper/cloudsplaining)
  • AttachUserPolicy/PutUserPolicy → AdministratorAccess
  • PassRole + RunInstances/CreateFunction → admin role
  • AssumeRole / UpdateAssumeRolePolicy
  • Azure: roleAssignments/write → Owner; Managed Identities (Azure Pentesting)
  • GCP: actAs/getAccessToken → impersonate admin SA (GCP Pentesting)
  • Confirm privileges and map the path