Template Trouble: How I Exploited a Logic Bug in a Templating En
A template preview endpoint rendered user-supplied input as a Jinja2 template, allowing server-side template injection. An attacker could execute arbitrary commands on the server, leading to remote code execution.
Free Link 🎈
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application rendered user-controlled input as a Jinja2 template without sandboxing or validation.
Impact
An attacker could execute arbitrary commands on the server, leading to full remote code execution.
What the attacker needed
Access to the preview endpoint; no authentication required
The fix
The application should avoid rendering user-controlled templates and use a sandboxed environment or safe rendering engine.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The website had a feature that let users preview templates, but it didn't check what users typed. By entering special template code, an attacker could make the server run commands, like reading files or opening a backdoor. This is called server-side template injection (SSTI).
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.