SECURITY ENGINEERING · PART 10 · CLOUD SECURITY · IDENTITY · 138 OF 229

Cloud Privilege Escalation Paths and Fixes

An attacker rarely lands as admin; they escalate. This episode shows how cloud privilege escalation works: dangerous permissions that let an identity grant itself more (PassRole, policy edits, key creation), how attackers map paths through the IAM graph, the role-chaining and confused-deputy tricks, and the defences that find these first.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 10

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Land low, climb via escalation primitives and role chaining
  • IAM is a graph
  • least privilege and boundaries
  • map paths

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.

Escalation primitives
  • 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.

The IAM graph
  • 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.

Chaining and confused deputy
  • 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.

How to stop it
  • 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.

From app role to 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.

Attack-path analysis
  • 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.

Avoid these
  • 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.

In the interview
  • "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."

Interview questions

Q1What is cloud privilege escalation?

The process by which an attacker turns a low-privilege cloud identity into a more powerful one, often reaching administrator, by exploiting permissions that allow modifying IAM or running code as a stronger role, rather than landing with high privileges initially.

Q2What are IAM escalation primitives?

Permissions that grant access to more access, such as editing IAM policies, creating access keys for other users, or using iam:PassRole to attach a powerful role to a compute resource and run code as it. A single such permission on a weak identity can enable full takeover.

Q3Why is iam:PassRole dangerous?

Because combined with the ability to launch or update a compute resource (an instance, function or container), it lets an identity attach a more powerful role and execute code as that role, inheriting its permissions. It is a classic escalation primitive and should be tightly scoped.

Q4What is role chaining?

Assuming one role that can assume another, and so on, hopping through a sequence of roles until reaching one with the desired privileges. Each assumption is individually legitimate, but the chain forms an escalation path, often enabled by over-open trust policies.

Q5How do attackers find escalation paths?

They model identities, roles and permissions as a graph where edges represent one identity reaching another, and search for a path from their foothold to administrator, using tools such as PMapper and Cloudsplaining. They only need one viable path.

Q6What is a confused deputy attack in the cloud?

Tricking a trusted service or role that has more privileges than the attacker into performing an action on the attacker's behalf, typically by abusing an over-permissive cross-account or service trust relationship. Scoping trust policies tightly prevents it.

Q7How do you defend against cloud privilege escalation?

Apply least privilege so escalation primitives are not granted unnecessarily, treat IAM-modifying permissions and PassRole as highly sensitive, use permission boundaries to cap what roles can become, tighten cross-account and service trust, and alert on policy, key and role changes.

Q8How can you proactively find escalation paths in your own account?

Run attack-path analysis tools such as PMapper or Cloudsplaining against your own environment, and use CSPM or CNAPP platforms that surface escalation paths. Ask what can reach administrator and whether it should, then close those paths and re-scan.