
Server-side template injection (SSTI) happens when user input is inserted into a server-side template (such as Jinja2, Twig, Freemarker or Velocity) and the template engine evaluates it.
SSTI is serious because template engines are powerful: an injection often leads to remote code execution on the server.
A developer builds a template string from user input, for example to personalise an email or a page title, instead of passing the input as data. An attacker submits template syntax such as {{7*7}}. If the response shows 49, the engine is evaluating their input, and more dangerous expressions can follow.
Template engines can access objects and functions on the server, so an injection often leads to remote code execution, not just data exposure.
Never build templates from user input. Pass user data as template variables, and use sandboxed or logic-less templates where possible.
Try Vooki Pro free for 7 days
SSTI can turn a text field into a server takeover. Find it before it ships. The trial unlocks every feature for 7 days, and scanning runs on your own machine.
Related: NoSQL injection: risks for MongoDB and other document databases · Server-side request forgery (SSRF) and cloud metadata attacks