Skip to content
uencoder

Template Injection

Server-Side Template Injection (SSTI) is attackers injecting template syntax into the rendering context, executing arbitrary code in the server-side template engine.

Purpose

To understand SSTI caused by user input reaching template rendering and its defenses; a common vulnerability in Jinja2/Freemarker and similar.

Mechanism

The program renders user input as a template via template.render(user_input); the attacker enters {{7*7}} or {{config}} to execute expressions or leak objects. Defenses: separate templates from data, sandboxing, safe rendering.

Use cases

  • Jinja2 SSTI
  • Freemarker security
  • Template engine audit

Related tools

References