Interview Prep/DevSecOps/Cloud IAM and Compliance

How do you detect and stop an IAM privilege escalation via `iam:PassRole`?

AdvancedScenarioCloud IAM and Compliance
Answer

Situation read → A user who can pass a powerful role to EC2 or Lambda, then run code there, gains that role's permissions.

What I'd do →

  1. Scope iam:PassRole to specific role ARNs and use the iam:PassedToService condition (e.g. only lambda.amazonaws.com).
  2. Find risky combinations with tools like PMapper or Cloudsplaining.
  3. Alert on PassRole of admin roles in CloudTrail (it shows up on the service API call, such as RunInstances or CreateFunction).
  4. Keep admin roles not passable by default.

Why → PassRole is the most common path from limited to full access in AWS.

Interview tip → Name the pattern: "PassRole plus compute create equals escalation".

All DevSecOps questions Roadmap: Policy as code

More on Cloud IAM and Compliance