Responsible Research Disclaimer: All code examples and research findings are provided for defensive and educational analysis under ethical security guidelines. HCV prohibits unauthorized exploitation.
## The Problem of IAM Entitlement Creep
In fast-paced cloud environments, developers and DevOps engineers frequently apply broad managed policies (such as `PowerUserAccess` or inline wildcard permissions) to eliminate immediate permission errors during deployments. Over time, these accumulate into a labyrinth of unintended privilege escalation opportunities.
An attacker who compromises a single web server or serverless function can query local metadata services (IMDS), extract temporary role credentials, and leverage latent permissions to seize control of the entire cloud organization.
## Common Escalation Paths
### 1. The `iam:PassRole` & Compute Creation Vector
If a role possesses permissions to create or update compute resources (such as EC2 instances or Lambda functions) along with `iam:PassRole`, an attacker can instantiate a resource and pass a high-privilege administrative role to it:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"lambda:InvokeFunction",
"iam:PassRole"
],
"Resource": "*"
}
]
}
```
By passing an existing administrator role to a freshly deployed Lambda function and invoking it, the attacker executes arbitrary commands under administrative privileges.
### 2. The Policy Version Creation Vector
When a role has permissions to create new policy versions (`iam:CreatePolicyVersion`), an attacker can update their own role policy to attach wildcard (`"Action": "*"`) permissions.
## Remediation & Defense-in-Depth
1. **Enforce Permission Boundaries**: Utilize IAM permission boundaries to cap the maximum privileges that delegated administrators or automation pipelines can grant.
2. **Restrict `iam:PassRole` with Resource Constraints**: Never grant `iam:PassRole` on `"Resource": "*"`. Bind it strictly to specific ARN roles required for the target workload.
3. **Enforce IMDSv2**: Require Instance Metadata Service Version 2 (IMDSv2) on all EC2 instances to neutralize SSRF-driven credential harvesting.
4. **Regularly Prune Unused Entitlements**: Use access analyzers to detect and remove permissions that have not been exercised within 90 days.
HCV
HCV Cloud Security Team
Specialized offensive and defensive cybersecurity researchers at Hack Cyber Verse, committed to actionable vulnerability analysis and resilient systems architecture.