All IAM escalation methodsCritical severity
AWS IAM privilege escalation • iam:PutUserPolicy

iam:PutUserPolicy Privilege Escalation

iam:PutUserPolicy writes an inline policy directly onto an IAM user. Unlike attaching a managed policy, the attacker authors the document themselves, so they can grant any permission to their own user without depending on an existing policy.

Permissions an attacker needs

  • iam:PutUserPolicy

How the escalation works

  • The attacker targets their own IAM user.
  • They call PutUserPolicy with an inline document granting Action "*" on Resource "*".
  • The inline policy takes effect immediately, giving the user administrator access.

Example vulnerable policy

A policy like this grants the dangerous permission. Paste your own policy into the free AI-Powered IAM analyzer to see if you are exposed.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iam:PutUserPolicy",
      "Resource": "*"
    }
  ]
}

Example exploitation

For illustration only — run against accounts you own or are authorized to test.

aws iam put-user-policy \
  --user-name attacker \
  --policy-name esc \
  --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}'

How to detect and prevent it

  • Avoid granting iam:PutUserPolicy except to tightly controlled automation, and scope it to specific users.
  • Enforce a permissions boundary so inline policies cannot exceed it.
  • Monitor PutUserPolicy, PutRolePolicy, and PutGroupPolicy in CloudTrail — inline policy writes are a strong escalation signal.

FAQ

Is an inline policy harder to detect than a managed one?

Inline policies do not show up in managed-policy inventories, so they are easier to overlook. Auditing requires enumerating inline policies per principal, which Shieldly and CloudTrail both surface.

Related escalation methods

Check your IAM policies for this — free

Shieldly's AI-Powered analyzer flags privilege-escalation paths, wildcards, and risky PassRole in seconds. No signup, no AWS credentials. Also ships as CLI, VS Code extension, GitHub Action, and CDK Guard.

Amazon Web Services (AWS) is a trademark of Amazon.com, Inc. Shieldly is not affiliated with, endorsed by, or sponsored by Amazon Web Services.