appsec.fyi

SSTI — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

SSTI: A Practical Guide

Curated and synthesized by . Last updated 2026-08-16. Synthesized from 97 of 97 curated resources. Browse all 97 SSTI resources →

Problem Framing

Server-Side Template Injection (SSTI) represents a critical class of vulnerabilities where an attacker can inject malicious template code into an application's server-side template processing. This injection allows for arbitrary code execution on the server, potentially leading to a complete system compromise, data exfiltration, and other severe security implications [1][2][3]. Template engines, designed to dynamically render content by combining static templates with data, are inherently capable of executing code. When user-supplied input bypasses proper validation and sanitization, it can be interpreted as executable template directives rather than literal data, creating the SSTI vulnerability [4][5][6].

This class of vulnerability is particularly insidious because it can be easily confused with or masked by other common web vulnerabilities like Cross-Site Scripting (XSS). However, the impact of SSTI is generally more severe, as it targets the server directly, whereas XSS targets the client's browser [4][7]. The core issue stems from a failure to strictly separate user-controlled data from the template's logic and execution environment [1][7].

Core Mechanics

SSTI vulnerabilities arise when user input is incorporated into server-side templates in an unsafe manner. This typically occurs in two primary ways:

1. Direct Concatenation/Interpolation: User input is directly embedded into a template string that is then processed by the template engine. If the template engine evaluates this input as code, SSTI occurs [4][5][8]. For example, a Flask application using Jinja2 might have code like: ```python from flask import Flask, request, render_template_string app = Flask(__name__)

@app.route("/") def index(): name = request.args.get('name') # Vulnerable: User input is directly concatenated into the template string template_string = f"Hello, {name}!" return render_template_string(template_string) `` In this scenario, if an attacker submits {{7*7}} as the name` parameter, the template engine will evaluate it, resulting in "Hello, 49!" [3][9].

2. Dynamic Template Resolution/Loading: The application dynamically selects or loads a template based on user input. If the user can control the template's content or name, they can inject malicious code [10][11].

The template engine's role is to parse these templates, interpret special syntax (e.g., {{ ... }}, ${ ... }, <%= ... %>), and render the final output. When this parsing and rendering process encounters user-controlled input that is interpreted as directives, the attacker can leverage the template engine's capabilities. These capabilities often include accessing application objects, calling functions, and, crucially, executing system commands or reading sensitive files [1][4][5][9].

The specific syntax and achievable actions are heavily dependent on the template engine in use, the programming language, and the application's specific implementation and configuration. Different template engines have different ways of accessing objects, methods, and built-in functions, which form the basis for SSTI exploitation [4][7][12].

Notable Techniques

Exploiting SSTI involves a series of steps: detection, template engine identification, and payload crafting for code execution or information disclosure.

Detection and Identification

The initial phase of SSTI detection often involves fuzzing input points with common template syntax markers.

Exploitation Paths

Once SSTI is confirmed, the goal is to escalate to Remote Code Execution (RCE) or other impactful actions by leveraging the template engine's capabilities. This often involves navigating Python's or Java's object inheritance trees and using reflection or built-in functions to access sensitive modules like os or Runtime.

Detection & Prevention

Preventing SSTI relies on a multi-layered security approach, focusing on secure coding practices, dependency management, and security testing.

Secure Coding Practices

Dependency Management

Security Testing

Tooling

Several tools are invaluable for detecting, identifying, and exploiting SSTI vulnerabilities:

Recent Developments

The landscape of SSTI is constantly evolving with new vulnerabilities and bypass techniques being discovered. Recent trends include:

Where to Go Deeper

For practitioners seeking to deepen their understanding and practical skills in SSTI, the following resources are highly recommended:

Sources cited in this guide

  1. SSTI: Explanation, Discovery, Exploitation, and Prevention — akto.io
  2. A Survey of the Overlooked Dangers of Template Engines (arXiv 2024) — arxiv.org
  3. What is SSTI in Flask/Jinja2? — Payatu — payatu.com
  4. SSTI: Breaking Out of Templates — kayssel.com
  5. Find and Exploit Server-Side Template Injection — TCM Security — tcm-sec.com
  6. What is Server-Side Template Injection? (Indusface) — indusface.com
  7. Inj3ctlab — SSTI Bug Bounty Labs Writeup — len4m.github.io
  8. ruby-ssti: example Ruby ERB app vulnerable to SSTI — github.com
  9. SSTI Explained with Real Code Examples - Xygeni — xygeni.io
  10. Don't Panic: The Thymeleaf Template Injection That Only Hurts If You Let It (CVE-2026-40478) — snyk.io
  11. GitHub Security Lab: SSTI in Apache Camel — CVE-2020-11994 — securitylab.github.com
  12. Mastering SSTI Exploitation: Executing Commands in Popular Templating Engines — medium.com
  13. OWASP Testing for Server Side Template Injection — owasp.org
  14. Server-side template injection | Web Security Academy — portswigger.net
  15. SSTI (The Hacker Recipes) — thehacker.recipes
  16. GoSecure: Template Injection in Action workshop — gosecure.github.io
  17. Flask & Jinja2 SSTI cheatsheet — pequalsnp-team.github.io
  18. Synack: Discovering an SSTI vulnerability in FreeMarker — synack.com
  19. PayloadsAllTheThings SSTI: Java — github.com
  20. Ruby ERB Template Injection (TrustedSec) — trustedsec.com
  21. Server Side Template Injection - Payloads All The Things — swisskyrepo.github.io
  22. A Pentester's Guide to SSTI - Cobalt — cobalt.io
  23. SSTI: Advanced Exploitation Guide - Intigriti — intigriti.com
  24. Exploiting SSTI in Thymeleaf — acunetix.com
  25. PayloadsAllTheThings — SSTI README — github.com
  26. SSTI - Server-side template injection with a custom exploit (Scott Murray) — sc.scomurr.com
  27. CVE-2025-23211: Jinja2 SSTI Turns Recipes Into RCE — vsec.com.br
  28. OnSecurity: Server Side Template Injection with Jinja2 — onsecurity.io
  29. YesWeHack: Limitations are just an illusion — advanced SSTI exploitation with RCE everywhere — yeswehack.com
  30. HackTricks: Jinja2 SSTI — book.hacktricks.xyz
  31. Exploiting CVE-2021-25770: SSTI in YouTrack (Synacktiv) — synacktiv.com
  32. Exploiting server-side template injection vulnerabilities — portswigger.net
  33. OpenMetadata: FreeMarker SSTI in email templates leads to RCE — github.com
  34. Grav CMS Twig SSTI Authenticated Sandbox Bypass RCE — rapid7.com
  35. Grav CMS: Security Sandbox Bypass with SSTI — github.com
  36. Grav CMS: RCE via SSTI through Twig Sandbox Bypass — github.com
  37. Handlebars.js: Safe Usage to Avoid Injection Flaws — xygeni.io
  38. Exploiting SSTI in a Modern Spring Boot Application — modzero.com
  39. Server-Side Template Injection | PortSwigger Research — portswigger.net
  40. Grav: SSTI via Twig escape handler advisory — github.com
  41. Jinja2 template injection filter bypasses (0day.work) — 0day.work
  42. Jinja2/Flask SSTI Filter bypass (MRLSECURITY) — mrlsecurity.com
  43. Exploiting Jinja SSTI with limited payload size — niebardzo.github.io
  44. SSTI: Transforming Web Apps from Assets to Liabilities — research.checkpoint.com
  45. Server-side template injection PortSwigger KB — portswigger.net
  46. Practical Exploitation of SSTI in Flask with Jinja2 — karczewski.io
  47. tplmap-python3: Python3 port (GitHub) — github.com
  48. vladko312/SSTImap: Automatic SSTI detection tool with interactive interface — github.com
  49. epinna/tplmap: SSTI and Code Injection Detection and Exploitation Tool — github.com
  50. PayloadsAllTheThings: Server Side Template Injection — github.com
  51. AST Injection: Prototype Pollution to RCE in Handlebars — po6ix.github.io
  52. A Simple Flask (Jinja2) SSTI Example (Kleiber) — kleiber.me
  53. ServiceNow RCE Exploitation Campaign — resecurity.com
  54. Multiple ServiceNow SSTI Vulnerabilities — censys.com
  55. ServiceNow RCE (CVE-2024-4879) Analysis — cyfirma.com
  56. Handlebars template injection and RCE in Shopify app — mahmoudsec.blogspot.com
  57. SSTI in Jinja2 allows RCE (changedetection.io) — github.com
  58. HackTricks: SSTI (Server Side Template Injection) — book.hacktricks.xyz
  59. SSTI in Bug Bounty: Playing with Handlebars and Breaking Stuff — medium.com
  60. Metasploit Module: Tactical RMM Jinja2 SSTI RCE (CVE-2025-69516) — github.com
  61. CVE-2026-33154: Dynaconf RCE via Insecure Jinja Template Evaluation — advisories.gitlab.com
  62. CVE-2026-27641: Flask-Reuploaded Path Traversal Enabling SSTI RCE — github.com
  63. Server-Side Template Injection — Bug Bounty 2k25 — medium.com
  64. Active Exploitation of Confluence CVE-2022-26134 (Rapid7) — rapid7.com
  65. Atlassian Confluence Widget Connector Macro SSTI (ExploitDB) — exploit-db.com
  66. SSTItoXSS: Exploiting SSTI to bypass WAF/XSS Filter — github.com
  67. SSTI in Freemarker (Akto) — akto.io
  68. PayloadsAllTheThings: SSTI Ruby payloads — github.com
  69. Code Execution via SSTI Ruby ERB (Invicti) — invicti.com
  70. Setting Up a Vulnerable SSTI Lab: A Hands-On Guide — medium.com
  71. SSTI in Flask/Jinja2 (IndominusByte) — medium.com
  72. Lab: SSTI in an unknown language with documented exploit — medium.com
  73. PayloadsAllTheThings - SSTI JavaScript engines — github.com
  74. HackerOne Report #423541: H1514 Server Side Template Injection — hackerone.com
  75. Strapi Security Disclosure: Multi-CVE SSTI chain — strapi.io
  76. Bug Bytes #124: SSTI to RCE in Go apps (Intigriti) — blog.intigriti.com
  77. Top 25 RCE Bug Bounty Reports (Cristian Cornea) — corneacristian.medium.com
  78. SSTI: Advanced Exploitation Techniques (BootstrapSecurity) — medium.com
  79. picoCTF 2025: SSTI2 Exploitation Writeup — medium.com
  80. picoCTF 2025: SSTI Challenge Writeup — medium.com
  81. SSTI: RCE for the Modern Web App - Black Hat 2015 — blackhat.com
  82. Deep Dive into SSTI: Finding and Exploiting Like a Pro — infosecwriteups.com
  83. CVE-2022-46166: Spring Boot Admin RCE — sangfor.com
  84. CVE-2021-43466: Thymeleaf Spring5 RCE — security.snyk.io
  85. HackerOne #164224: SSTI — hackerone.com
  86. RCE via SSTI in Fides Jinja Email Templates — github.com
  87. CVE-2024-29178: Apache StreamPark FreeMarker SSTI — openwall.com
  88. SpringBootAdmin Thymeleaf SSTI to RCE — github.com
  89. Method Confusion in Go SSTIs Lead to RCE — onsecurity.io
  90. Exploiting SSTI in Golang Frameworks — payatu.com
  91. Golang SSTI: Safe by Default or Vulnerable by Design — oligo.security
  92. CVE-2025-23211: Tandoor Recipes Jinja2 SSTI to RCE — offsec.com
  93. Jinja2 SSTI filter bypasses — medium.com
  94. Exploit-DB: Twig 2.4.4 Server Side Template Injection — exploit-db.com
  95. CVE-2023-49964: FreeMarker SSTI in Alfresco — github.com
  96. Breaking the Barrier: RCE via SSTI in FreeMarker — medium.com
  97. Template Injection Research | PortSwigger Research — portswigger.net
📚 This guide is synthesized from the full text of resources curated in the SSTI library, and refreshed as new material is added.