Skip to main content
Server-Side Template Injection (SSTI) occurs when user input is unsafely embedded into a template that is executed on the server, potentially leading to Remote Code Execution.

Detection

1

Fuzz the Template

Inject a sequence of special characters: ${{<%[%'"}}%\Observe server responses for errors or unexpected evaluation.
2

Distinguish from XSS

Test mathematical expressions:
  • {{7*7}}49 (template evaluated)
  • ${7*7}49 or ${7*7} (depends on engine)
  • <%= 7*7 %>49 (Ruby/ASP style)
3

Identify the Engine

Different engines use different syntax. Use this flowchart approach:
  • {{7*7}} → 49: Twig or Jinja2
  • {{7*'7'}}7777777: Jinja2
  • ${7*7} → 49: FreeMarker or Spring EL
  • <%= 7*7 %> → 49: ERB (Ruby)
  • @(2+2) → 4: Razor (.NET)

Automated Tools

Exploitation by Engine

Java Template Engines

NodeJS Template Engines

XWiki SolrSearch Groovy RCE (CVE-2025-24893)

XWiki ≤ 15.10.10 renders unauthenticated RSS search feeds through the Main.SolrSearch macro. Injecting }}} followed by {{groovy}} executes arbitrary Groovy in the JVM.

Go Template Injection

Resources