githubEdit

SSTI (Server-Side Template Injection)

Automation

  • SSTImaparrow-up-right

    ./sstimap.py -u https://example.com/?name=test
    ./sstimap.py -u https://example.com -m POST -d "name=test"

Identify the Template Engine/Framework/Language

Payload
Template Engine/Framework/Language

a{*comment*}b

Smarty

#{ 2*3 }

Pug, Spring

*{ 2*3 }

Spring

${"z".join("ab")}

Mako, ???

{{ '7'*7 }}

Angular, Django, Flask, Go, Jinja2, Tornado, Twig, ???

{{:2*3}}

JsRender

{% debug %}

Django

<%= 7*7 %>

ERB (Embedded Ruby)

SSTI for Each Framework

Please see each article for details about SSTI.

ERB SSTI

ERB may be vulnerable to SSTI.

Payloads

Try the following payloads on URL path, params, input, etc.

Exploit

If the above payloads affect responses, we can inject arbitrary code as below:

References

Last updated