Confirming SSTI
The process of identifying an SSTI vulnerability is similar to the process of identifying any other injection vulnerability, such as SQL injection. The most effective way is to inject special characters with semantic meaning in template engines and observe the web application’s behavior. The following polyglot test string is commonly used to provoke an error message in a web application vulnerable to SSTI, as it consists of all special characters that have a particular semantic purpose in popular template engines:49 comes back in the response, you’ve got SSTI. Before exploiting further, you need to identify which template engine is in use, payloads are not portable between various engines.
Identifying the Template Engine
We can use slight variations in the behavior of different template engines to determine which one is in use. Each delimiter style and math operator narrows down the possible engine:
Template Engines
- Jinja2 (Python)
- Twig (PHP)
- Smarty (PHP)
- Velocity (Java)
- ERB (Ruby)
Automated Tools
SSTImap identifies the engine and automates exploitation (file read, command execution, interactive shell and more..)Quick Reference Tools
SSTImap
Detects the engine and automates exploitation across Jinja2, Twig, Mako, Freemarker, and more.
tplmap
Older Python 2 SSTI automation tool, still useful as a fallback.
PayloadsAllTheThings: SSTI
Per-language payload breakdown (Python, PHP, Java, Ruby, JavaScript) with sandbox-bypass chains.
HackTricks: SSTI
Broader engine coverage including less common ones (Pebble, Thymeleaf, Mako, Tornado).
PortSwigger: SSTI
Methodology writeup and Academy labs for practicing detection and exploitation.

