Skip to content

Lesson 3 of 9 · 25m

IAM Misconfigurations: How Policy Evaluation Really Works

Identity policies, resource policies, permission boundaries, SCPs, and the exact misconfigurations that turn small access into privilege escalation.

IAM failures are rarely "the policy allowed too much" in the abstract. They are evaluation failures: someone understood one layer and forgot the other four. The mental model is simple but strict — an action is allowed only when every applicable layer allows it and no layer explicitly denies it. Attackers exploit the seams between those layers because defenders often audit only one.

The evaluation stack

request
  ├─ explicit deny anywhere?           → DENY
  ├─ SCP allows it?                    → required for org accounts
  ├─ permission boundary allows it?    → required when present
  ├─ identity policy allows it?        → needed for most IAM users/roles
  └─ resource policy/trust allows it?  → required for cross-account/resource access

A role trust policy is a resource policy. It says who may call sts:AssumeRole; it does not grant the caller any permissions inside the role. Those live in identity policies attached to the role.

The dangerous actions

Some permissions matter because they create or modify other access:

iam:CreateAccessKey          mint keys for a user
iam:AttachUserPolicy         attach stronger policy
iam:PassRole                 give a service a role to run as
lambda:CreateFunction        execute code as a passed role
lambda:UpdateFunctionCode    replace existing execution code
ec2:RunInstances             launch an instance with a profile
iam:UpdateAssumeRolePolicy   rewrite who can assume a role

iam:PassRole is the classic pivot. By itself it does nothing; combined with a service that executes code, it becomes role assumption by proxy. The correct control is usually a narrow pairing:

{
  "Effect": "Allow",
  "Action": "iam:PassRole",
  "Resource": "arn:aws:iam::111122223333:role/report-runner",
  "Condition": {"StringEquals": {"iam:PassedToService": "lambda.amazonaws.com"}}
}

Conditions are where intent lives

Policies often look safe until you notice the missing conditions: no MFA requirement, no source IP restriction, no aws:PrincipalOrgID, no service constraint on PassRole. A realistic tightening is "Condition": {"StringEquals": {"aws:PrincipalOrgID": "o-abc123defg"}, "Bool": {"aws:MultiFactorAuthPresent": "true"}}; conditions are often the only difference between administrative convenience and cross-tenant exposure.

Validate with simulation before exploitation

Use IAM policy simulation and access analyzer findings to confirm reachability before touching a resource:

aws iam simulate-principal-policy   --policy-source-arn arn:aws:iam::111122223333:role/build-deployer   --action-names iam:PassRole lambda:CreateFunction

Simulation is not perfect — resource policies, SCP quirks, and service-specific behavior can surprise you — but it forces you to name the path precisely.

Field notes

  • NotAction plus Effect: Allow is usually a future incident. New services inherit access nobody consciously granted.
  • Wildcard resources are sometimes required by AWS API design, but wildcard actions plus wildcard resources should trigger immediate review.
  • aws:ResourceTag conditions fail silently when resources are untagged; inventory quality is a security control.
  • Permission boundaries are easy to misunderstand: they restrict maximum permissions, they never grant permissions.

Was this lesson helpful?

Sign in to rate