Attack scenario · AWS identity & access

Privilege escalation through IAM policy relationships

How can IAM privilege escalation occur in AWS? A developer role that can pass roles to Lambda and create functions can run code as a far more privileged role — without ever being granted administrator rights directly.

Fictional, educational scenarioPrivilege takeoverData exposureLast updated · ATT&CK v20.1

Attack path · 5 stages

  1. 1

    Obtain developer access

    T1078.004

  2. 2

    Find a passable privileged role

    T1087.004T1069.003

  3. 3

    Create a function with the privileged role

    T1648T1548.005

  4. 4

    Run code as administrator

    T1098.003

  5. 5

    Use administrator access

    T1530T1685.002

For leadership

Executive summary

In AWS, the most dangerous access is often not granted directly. Individually reasonable permissions — "can create Lambda functions" and "can assign roles to services" — combine so that a developer, or anyone who steals that developer’s credentials, can make AWS run code with an administrator’s authority. These combinations are hard to spot by reading policies one at a time, which is why they survive reviews and audits. Leaders should ask whether the team can list every identity that can effectively become an administrator, not just those labelled as administrators.

For engineers

Technical summary

iam:PassRole on a privileged role combined with lambda:CreateFunction and lambda:InvokeFunction (or equivalents with EC2 RunInstances, ECS RunTask, CloudFormation CreateStack, Glue, SageMaker) lets the caller execute code with the passed role’s permissions. Similar paths exist through iam:CreatePolicyVersion, iam:AttachUserPolicy or iam:UpdateAssumeRolePolicy.

Environment and assumptions

Fictional company: a "developer" role in the staging-and-tools account has lambda:* and iam:PassRole on Resource "*". The same account contains "platform-admin-exec", a role with AdministratorAccess that Lambda is allowed to assume, used by an internal automation tool.

  • The adversary has the developer role’s credentials (stolen session, compromised laptop, or malicious insider).
  • iam:PassRole is not scoped by resource or iam:PassedToService.
  • A role with high privileges trusts lambda.amazonaws.com.
  • Fictional and simplified for education.

Interactive

Attack sequence

Select a stage, or use the arrow keys, to see preconditions, evidence and controls.

Stage 1

Obtain developer access

The adversary operates with the developer role’s session.

Preconditions
  • Compromised developer identity
Required access
  • Developer role session.
Potential evidence
  • IdP sign-in anomalies; CloudTrail activity from unusual locations
Defensive controls
  • Phishing-resistant MFA
  • Short session durations
Text version of the attack sequence
  1. Obtain developer access (T1078.004). The adversary operates with the developer role’s session. Preconditions: Compromised developer identity. Evidence: IdP sign-in anomalies; CloudTrail activity from unusual locations. Controls: Phishing-resistant MFA; Short session durations.
  2. Find a passable privileged role (T1087.004, T1069.003). The adversary lists roles and their trust policies, looking for privileged roles that trust a compute service. Preconditions: iam:ListRoles / GetRole. Evidence: CloudTrail: ListRoles, GetRole, ListAttachedRolePolicies bursts. Controls: Limit IAM read for developer roles where feasible.
  3. Create a function with the privileged role (T1648, T1548.005). The adversary creates a Lambda function, passing "platform-admin-exec" as its execution role. Preconditions: lambda:CreateFunction; iam:PassRole on the privileged role. Evidence: CloudTrail: CreateFunction (with API-version suffix) whose role parameter is a privileged role; PassRole is authorized implicitly. Controls: Scope iam:PassRole to specific roles with iam:PassedToService; Alert on functions created with privileged roles.
  4. Run code as administrator (T1098.003). Invoking the function runs code that attaches AdministratorAccess to the adversary’s own identity or creates new credentials. Preconditions: lambda:InvokeFunction. Evidence: CloudTrail: AttachUserPolicy / AttachRolePolicy where userIdentity is the Lambda execution role. Controls: Permission boundaries; Alert on IAM changes made by Lambda execution roles.
  5. Use administrator access (T1530, T1685.002). With administrator rights the adversary can read data and tamper with logging in that account. Preconditions: Escalation succeeded. Evidence: CloudTrail; GuardDuty findings for logging changes. Controls: SCPs protecting logging; Data perimeter on sensitive stores.

Technique mapping

MITRE ATT&CK and ATLAS techniques referenced in this scenario
IDTechniqueTactics (official)Stages
T1078.004Valid Accounts: Cloud AccountsInitial Access, Persistence, Privilege Escalation, Stealth1
T1087.004Account Discovery: Cloud AccountDiscovery2
T1069.003Permission Groups Discovery: Cloud GroupsDiscovery2
T1648Serverless ExecutionExecution3
T1548.005Abuse Elevation Control Mechanism: Temporary Elevated Cloud AccessPrivilege Escalation3
T1098.003Account Manipulation: Additional Cloud RolesPersistence, Privilege Escalation4
T1530Data from Cloud StorageCollection5
T1685.002Disable or Modify Tools: Disable or Modify Cloud LogDefense Impairment5

Technique names and tactic assignments come from the imported MITRE data. Mapping a stage to a technique is Securitain’s analysis.

Why the attack can succeed

  • Policies are reviewed one at a time; the dangerous combination only exists across them.
  • PassRole on Resource "*" is common because it is needed for many deployment tasks.
  • A highly privileged role trusts a compute service, so any identity able to pass it can borrow it.

What prevents or limits the attack

What may detect the attack

Detection signals and telemetry sources
SignalTelemetry sourceNotes
Lambda function created or updated with a privileged execution roleCloudTrail management events—
IAM policy changes performed by a Lambda execution role sessionCloudTrail management eventsuserIdentity.type = AssumedRole with a Lambda function session name.
Enumeration of roles and trust policies by a developer identityCloudTrail management eventsNoisy on its own; useful as context.

Telemetry only helps if it is enabled before the incident and someone acts on it. Listing a signal here does not mean it is collected or monitored in your environment.

What Securitain may assess

  • Securitain can assess todayPrivilege-escalation risk analysis for supported combinations such as iam:PassRole with Lambda, EC2, ECS or CloudFormation. Learn more
  • Securitain can assess todayEffective-permission view that considers managed, inline, group, boundary and SCP policies together. Learn more
  • Securitain can assess todayInventory of IAM users, roles, groups, policies, access-key configuration and trust relationships across connected AWS accounts. Learn more
  • Securitain can assess todayFinding-to-control mapping for supported frameworks (for example CIS, SOC 2, HIPAA, NIST and PCI DSS). Learn more

For leadership

Executive implications

integrity
Full administrative control of the account allows changes to any resource or identity.
confidentiality
All data in the account becomes reachable.
compliance
Segregation of duties and least privilege controls are effectively bypassed.

No financial loss estimates are given; impact depends on the data, contracts and regulation involved.

Next steps

  1. List identities that hold iam:PassRole on "*" together with compute-creation permissions.
  2. List privileged roles that trust Lambda, EC2, ECS, Glue, SageMaker or CloudFormation.
  3. Scope PassRole and split privileged automation roles.
  4. Alert on privileged roles being attached to new compute.

References

MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation. ATT&CK data © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (ATT&CK v20.1). Securitain is not affiliated with or endorsed by MITRE. Explanations, scenarios and control mappings on this page are Securitain’s own analysis. Sources and licensing

Stay in the loop

Cloud security insights, early access & compliance updates

Weekly InsightsEarly AccessExpert Content
No spam, everUnsubscribe anytimeWeekly updates
Chat with Securitain