Web Security Series #19 — Exploiting Hidden Server-Side Templat
The greeting card feature was vulnerable to server-side template injection because user input was embedded into a template engine without sanitisation. An attacker could inject template expressions that executed on the server, leading to command execution and system compromise.
Published on medium.com
Server-Side Template Injection (SSTI) vulnerabilities can sometimes be hidden behind client-side rendering, making them harder to detect during initial testing.
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
Likely the application embedded user input directly into a template engine without sanitisation or sandboxing.
Impact
An attacker could achieve remote code execution, leading to data leakage, privilege escalation, and full system compromise.
What the attacker needed
Access to the card generation feature; ability to intercept HTTP requests
The fix
The application should avoid rendering user input in templates, use strict input validation, enable template sandboxing, and escape user-controlled data.
How it was found
- Enter a basic SSTI payload in the Image Template field.
- Click Edit Card and save without changes to send a POST request.
- In Burp Suite, send the request to Repeater and inspect the response.
- Observe the server response showing the evaluated result.
- Replace the payload with a command execution payload and save.
- Send the request again in Repeater and observe the command output.
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.
Server-Side Template Injection (SSTI) happens when a website puts user input directly into a template that runs on the server. This lets an attacker run code on the server, like reading files or executing commands. In this lab, the browser hid the server's response, but by looking at the raw response in Burp Suite, the attacker confirmed the injection and ran a command.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.