Cloud IAM Privilege Escalation

Small permissions that add up to admin

In the cloud, identity is the perimeter. A user who can't do anything dangerous directly may still hold a combination of permissions that lets them borrow a more powerful role. The classic example is being allowed to create a function and "pass" an admin role to it.

Advanced · 5 steps

TechniqueT1098 (Account Manipulation), T1078.004 (Cloud Accounts)
Classic comboiam:PassRole + create/run compute
Other pathsEdit own policy, create access keys for others
GuardrailsPermission boundaries, SCPs
AnalysisIAM Access Analyzer, path-finding tools
PrincipleLeast privilege, no wildcards

Step by step

  1. A limited foothold Leaked developer credentials

    An attacker obtains a developer's access key, perhaps from a laptop or a leaked file. The developer's policy looks safe: no admin rights, no ability to edit IAM. The attacker starts by listing what this identity can do.

  2. The dangerous combination PassRole on any role

    iam:PassRole lets a user attach a role to a resource they create. It was granted on * "so deployments don't fail". Combined with permission to create functions, the user can create code that runs with any role in the account, including an admin role.

  3. Borrow the admin role Code runs with someone else's rights

    The attacker creates a small function, passes ops-admin-role to it, and invokes it. The function's code calls IAM to create a new access key for an admin user, which it returns. The developer key has become admin access.

  4. Spotted in the audit log Unusual IAM activity

    CloudTrail records every API call. Detection rules flag a function created with an admin role by a non-admin identity, and an access key created for an admin user from inside a function. The SOC disables the keys and deletes the function.

  5. Close the path Least privilege with guardrails

    PassRole is limited to the specific role the developer's functions need. A permission boundary caps anything the developer creates at their own level, and an organisation policy blocks creating access keys for admin users except through a break-glass process. Path-analysis tools are run regularly to catch new combinations.

How to defend

More in Cloud Security.