Notes
The idea
The core idea: certain permissions are not just access, they are keys to more access. If you can edit an IAM policy, you can grant yourself admin. If you can create an access key for another user, you become them. If you can pass a powerful role to a new compute instance or function and run code on it, you inherit that role's power. These are called escalation primitives, and a single one in the hands of a low-privilege identity can mean full account takeover.
- some permissions are keys to more permissions
- edit a policy -> grant yourself admin
- create an access key for another user
- iam:PassRole + launch a compute resource as a powerful role
- create/update a function or instance with a big role
Mapping paths
Attackers do not guess; they map. Identities, roles and permissions form a graph, where an edge means this identity can reach that one, by assuming a role, editing a policy, or passing a role. Attackers search the graph for any path from their foothold to administrator, and tools like PMapper automate it. The hard part is that they only need one path, while you must close them all. Thinking of your own IAM as a graph, and checking what reaches admin, is the defender's version of the same technique.
- identities, roles and permissions form a graph
- an edge = "this identity can reach that one"
- attackers search for a path from their foothold to admin
- tools: PMapper, Cloudsplaining, cloud-specific enum scripts
- one path is all they need
Role chaining
Two specific tricks. Role chaining: you assume role A, which can assume role B, which can assume something powerful, hopping along until you reach admin. Each hop is legitimate; the chain is the attack. And the confused deputy: you trick a trusted service that has more power than you into acting on your behalf, for example an over-trusting cross-account role. Both exploit trust relationships that looked reasonable alone but combine into a path. Over-open cross-account trust is a frequent culprit.
- role chaining: assume role A, which can assume role B, which can assume admin
- confused deputy: trick a trusted service into acting for you
- cross-account trust that is too open
- each hop looks legitimate; the chain is the attack
Defences
The defences follow from the primitives. First, least privilege: do not grant the escalation permissions to identities that do not need them, and treat IAM-modifying permissions, PassRole, policy edits, key creation, as highly sensitive. Second, permission boundaries that cap what any role can ever become. Third, tighten cross-account and service trust policies so they are specific, not open. And fourth, alert on the telltale actions: policy changes, new access keys, new roles.
- least privilege: do not grant the escalation primitives
- treat iam:*, PassRole, policy edits as highly sensitive
- permission boundaries cap what a role can become
- tighten cross-account and service trust policies
- alert on policy changes and new keys/roles
A worked example
Here is a concrete chain. The foothold is a web application role that can create a function and happens to have PassRole on an admin role, over-granted at some point and forgotten. The attacker creates a new function, passes it the admin role, and runs their own code inside it. That code now executes with admin permissions, and the account is theirs. Two ordinary-looking permissions, launch a function and PassRole, combined into total compromise. This is why PassRole on anything powerful is treated as near-admin.
- foothold: a web app role that can launch a function
- it also has iam:PassRole on an admin role (over-granted)
- attacker creates a function, passes the admin role to it
- runs code as admin inside the function
- game over: one over-granted permission did it
Find paths first
The best defence is to find the paths before attackers do, by running the same analysis on yourself. Point PMapper or Cloudsplaining at your own account, and use the posture tools from later episodes, posture management and CNAPP platforms like Wiz, which are strong at surfacing escalation paths. The question to keep asking is: what can reach administrator, and should it? Then close those paths and re-scan. This turns escalation from something that happens to you into something you hunt.
- run PMapper/Cloudsplaining on your own account
- CSPM and CNAPP tools surface escalation paths (next episodes; Wiz is strong here)
- question to ask: what can reach admin, and should it?
- fix the paths, then re-scan
- this is proactive, not reactive
Common mistakes
Mistakes that make escalation easy. Handing out IAM-wildcard or PassRole permissions broadly, because they seem harmless. Giving policy-edit permissions to low-privilege identities, which lets them rewrite their own access. Open cross-account trust that anyone can assume. No permission boundaries, so a granted escalation has no ceiling. Never mapping which identities can reach admin. And no alerting on policy or key changes, so an escalation in progress is invisible. Each is a gift to the graph-walking attacker.
- handing out iam:* or PassRole broadly
- policy-edit permissions on low-priv identities
- open cross-account trust
- no permission boundaries
- never mapping paths to admin
- no alerting on policy or key changes
Say it like this
In the interview: attackers rarely land as admin; they land low and escalate. They use primitives, a policy edit to grant themselves admin, creating an access key, or PassRole to run code as a powerful role, and chain roles through the IAM graph to admin. I defend by not granting those sensitive permissions to identities that do not need them, applying permission boundaries, tightening trust, and alerting on policy and key changes. And I run attack-path tools like PMapper on my own account to close the paths first.
- "Attackers land low, then use
- escalation primitives, policy
- edits, PassRole, key creation, role chaining, to climb to admin, treating IAM as a graph.
- I defend with least privilege
- on those sensitive permissions, permission boundaries, tight
- trust policies, alerting, and attack-path tools on myself."