Injection
Server-Side Template Injection
SSTI occurs when user input is embedded in a server-side template unsafely, allowing attackers to execute arbitrary code on the server.
- 167 payloads
- 1 file
- README on GitHub
Payloads are read from main at 35c1f2b (committed 22 Nov 2026). Project version 1.0.2.
These payloads are for authorized testing only: systems you own, authorized bug bounty programs, or controlled lab environments. Unauthorized testing is illegal.
Payload files
Use the arrow keys to move between payloads. Press Enter or C to copy the focused payload.
ssti-payloads.txt
167 payloads · 7.4 KBLoading payloads for SSTI…
What it is#
Server-Side Template Injection (SSTI) occurs when user input is embedded in a template in an unsafe manner, allowing attackers to inject template directives and execute arbitrary code on the server. SSTI can lead to remote code execution, information disclosure, and complete server compromise. Vulnerable template engines include Jinja2 (Python), Twig (PHP), Freemarker (Java), Velocity (Java), Smarty (PHP), Pug (Node.js), ERB (Ruby), and Thymeleaf (Java).
Attack vectors#
- User input used in template rendering functions
- Email templates with user-controlled content
- Error messages generated from dynamic templates
- Report and PDF generators with user-defined content
- Markdown or wiki renderers backed by template engines
Testing methodology#
- Submit {{7*7}} and observe if 49 appears in the response
- Try ${7*7} and #{7*7} to detect different engines
- Use the polyglot probe: ${{<%[%'"}}%\` to trigger engine-specific errors
- Identify the template engine from error messages or response differences
- Escalate to code execution using engine-specific RCE payloads
Indicators of vulnerability#
- Mathematical expression result (e.g., 49) returned for {{7*7}} input
- Template syntax errors revealing engine type
- Server-side configuration or environment data exposed
- Command output embedded in response
Detection guidance#
Audit all template rendering calls to ensure user input is passed as data, not as template source. Use static analysis to find unsafe render() calls. Monitor for template engine error messages in production logs.
Mitigation and remediation#
- Never pass user input directly as template source code
- Use sandboxed template environments where available
- Validate and sanitize input before rendering
- Apply principle of least privilege to template execution context
- Use logic-less templates (Mustache/Handlebars) when possible
References#
Responsible Use
All content in this reference is for authorized security testing only. Use only on systems you own or have explicit written permission to test.
- Systems and applications you own
- Authorized penetration testing engagements
- Bug bounty programs with defined scope
- Educational lab environments (DVWA, WebGoat, HackTheBox)