Skip to content
ShankarStack
HighInput Validation

Server-Side Template Injection (SSTI)

Untrusted input is evaluated by a server-side template engine, allowing the input to influence template execution.

SSTI arises when user input is concatenated into a template that the server then renders, so the input is treated as template syntax rather than data.

Root cause

User-controlled data is placed into template source instead of being passed as a bound variable to a pre-defined template.

Impact

Depending on the engine and sandbox, impact ranges from information disclosure to significant server-side compromise.

Detection methodology

Identify where user input reaches template rendering; in an authorised test, observe whether template expressions are evaluated rather than echoed.

Remediation

Never build templates from user input. Pass untrusted data only as bound variables, use logic-less or sandboxed templates, and keep engines patched.

Secure coding guidance

Treat templates as code: author them statically and feed data in through the engine's variable interface, never via string concatenation.