Course contentsShow
← Security
Lesson 1756 of 3,05235. Cloud Security - IAMFree lesson

Role Assumption and Trust Policy Exploitation

Exploiting overly permissive trust policies and AssumeRole permissions to gain unauthorized access to privileged roles.

Role Assumption and Trust Policy Exploitation

What you'll learn: How attackers exploit misconfigured trust policies and overly permissive AssumeRole permissions to gain unauthorized access to powerful cloud roles.

The Core Problem

In cloud IAM, roles use trust policies to define who can assume them. Think of a trust policy as a guest list at an exclusive club—it determines which identities are allowed to "become" that role temporarily. When these trust policies are too permissive, attackers can assume roles they shouldn't have access to, effectively hijacking privileges.

How the Exploit Works

A trust policy might inadvertently allow:

  • Any authenticated user in the account (using * principals)
  • All roles from another account instead of specific ones
  • Services or federated users with overly broad conditions

For example, a trust policy like this is dangerously permissive:

{
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::123456789012:root" },
  "Action": "sts:AssumeRole"
}

This allows any identity in account 123456789012 to assume the role—not just intended users.

The Attack Path

An attacker who compromises a low-privilege account can:

  1. Enumerate roles and their trust policies
  2. Identify roles with weak trust relationships
  3. Call AssumeRole to obtain temporary credentials for the privileged role
  4. Access sensitive resources using the elevated permissions

Real-World Impact

This is a common privilege escalation vector. Attackers move laterally from compromised service accounts or developers' credentials into admin-level roles, bypassing intended access controls.

Key Takeaway: Always restrict trust policies to specific, necessary principals and use conditions to limit when and how roles can be assumed—never trust entire accounts or use wildcard principals unless absolutely required and well-understood.