When user input is rendered as a template, braces are not formatting; they are expression delimiters. The template engine evaluates them on the server.
The application concatenates user text into a template and renders it. An expression such as `{{7*7}}` proves evaluation; a server variable such as `{{flag}}` reads protected context.
- Test the template renderer
- Reach a server-side variable
- Render the flag and capture it
User data to template source
Where to look before you type a payload
A feature accepts text that will later be rendered, such as a greeting, report title or email body.
The application concatenates the text into a template string instead of passing it as a variable.
The template engine parses the combined text and treats attacker syntax as template code.
Expressions execute with the engine's context, which may include globals, helpers and filesystem access.
Open one hint at a time. The first two build the model; the last two point at the boundary.
Hint 1
Find the template preview.
Hint 2
Try `{{7*7}}` and observe whether it evaluates.
Hint 3
The preview evaluates template expressions. Try {{7*7}}, then {{flag}}.
Hint 4 · near the answer
Render `{{flag}}` and capture the flag.
Observe → Hypothesize → Test → Prove → Explain
This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.
Evidence log
Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.
Preview the evidence report
# Lab evidence report — Report Template Injection
- Family: SSTI
- Lab ID: web-ssti-report
- Date: 2026-12-05
## Workflow
### Observe
- [ ] Open "Report Template Injection" and record /preview, the HTTP method and the role you are given.
- [ ] List every parameter, header, cookie and object identifier the normal flow exposes.
- [ ] Save a baseline response: status, body shape, timing and the fields that change by user.
### Hypothesize
- [ ] Name the server decision that protects /preview, and the evidence it should use.
- [ ] Use the clue as a constraint, not an answer: The preview renders {{ ... }} expressions. Try the flag variable.
- [ ] Predict the exact status, body or state change that would prove the decision is missing.
### Test
- [ ] Start from the baseline and change one value: the template preview field.
- [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result.
- [ ] Capture the full request and response for the winning attempt, including the flag.
### Prove
- [ ] Capture the flag and name the exact foreign object, role or state change it proves.
- [ ] Repeat from a clean session and confirm the result is not cached or stale.
- [ ] State impact precisely: what data or action did you actually obtain?
### Explain
- [ ] State the root cause without naming the payload: which decision failed?
- [ ] Name the control that prevents recurrence and the layer where it belongs.
- [ ] Write one regression test that fails before the fix and passes after it.
## Evidence
### Target and baseline
_Not recorded._
### Hypothesis
_Not recorded._
### Winning request
_Not recorded._
### Proof
_Not recorded._
### Root cause
_Not recorded._
### Control and regression test
_Not recorded._
## Analyst conclusion
The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.
False positives to rule out
- The page reflects {{7*7}} literally: it is output encoding, not evaluation. Confirm with several engines and contexts.
- A math expression renders but globals are unavailable: the engine may use a restricted context; still treat evaluation as a finding.
- The input is rendered in the browser only: that is DOM XSS, not SSTI, unless the server compiles it.
Regression tests to name
- Arithmetic probe: The literal text is rendered, not the result
- Global access: The context does not expose those objects
- Sandbox escape: The sandbox denies it and the attempt is logged
- Use logic-less templates and never render user-supplied template source.
- Pass data as values, not as template fragments.
- Sandbox the renderer and remove secrets from its context.
القالب ليس نصًا؛ إنه كود يتنكر في شكل نص.