What is the risk of `iam:PassRole` with `Resource: "*"` and how do you scope it?
IntermediateProductionIAM Best Practices
Answer
Anyone who can pass any role and launch compute (EC2, Lambda, ECS, Glue) can run code as the most powerful role in the account, which is a privilege escalation. Scope it to specific role ARNs or a path, and restrict which service the role can be passed to:
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::111122223333:role/app/*",
"Condition": {"StringEquals": {"iam:PassedToService": "ecs-tasks.amazonaws.com"}}
}
More on IAM Best Practices
What does least privilege look like in practice, not in theory?BeginnerWhat are the IAM rules you enforce for humans?BeginnerHow do you design Identity Center permission sets for many teams?IntermediateHow does ABAC with Identity Center work, and when is it worth it?AdvancedWhen do you use permission boundaries in production?IntermediateHow do you remove long-lived access keys from an existing estate?Intermediate