Course contentsShow
← Security
Lesson 1759 of 3,05235. Cloud Security - IAMFree lesson

PassRole Permission Exploitation

Understanding and exploiting PassRole permissions to assign privileged roles to services under attacker control.

PassRole Permission Exploitation

What you'll learn: How attackers exploit the iam:PassRole permission to escalate privileges by assigning powerful roles to services they control.

What is PassRole?

In cloud environments, certain services need to operate with permissions—think Lambda functions, EC2 instances, or container tasks. The iam:PassRole permission allows a user to hand off (pass) an IAM role to a service. It's like giving someone the key to a company car: you're not driving yourself, but you're deciding who gets to drive.

This permission exists separately from AssumeRole (which you learned about earlier). While AssumeRole lets you become the role, PassRole lets you tell a service to become the role.

The Exploitation Path

Imagine you have permissions to:

  1. Create a Lambda function (lambda:CreateFunction)
  2. Pass any role to Lambda (iam:PassRole on *)

Even if you can't assume the powerful AdminRole yourself, you can:

  • Create a Lambda function that executes code you control
  • Pass AdminRole to that Lambda
  • Invoke the Lambda, which now runs with admin privileges
  • Extract credentials, modify resources, or execute commands

The service acts as your privilege escalation proxy—you didn't become admin, but your code runs as admin.

Common Attack Vectors

Services frequently exploited via PassRole include:

  • Lambda functions (execute arbitrary code)
  • EC2 instances (launch instances with privileged roles)
  • Glue/DataPipeline jobs (run scripts with passed roles)
  • Container services (ECS/Fargate tasks with escalated permissions)

Defensive Measures

Restrict PassRole using resource conditions:

"Action": "iam:PassRole",
"Resource": "arn:aws:iam::*:role/LimitedServiceRole"

Never grant PassRole on * without strong justification.

Key Takeaway: PassRole permission allows attackers to indirectly execute actions with privileged roles by creating services under their control—always restrict which roles can be passed to which services.