Skip to content
RCE Write-up Intermediate

How I Found SSTI in a Search Bar

A search parameter on a website was passed into a server-side template engine, so template expressions in the query were evaluated rather than treated as plain text. An attacker could inject template syntax into the search box and have the server evaluate it, which may lead to remote code execution depending on the engine.

medium.com

Published on medium.com

Nothing looked immediately suspicious, but something about it made me curious. Since the input was sent as a GET parameter (?s=query), I decided to test how the backend processed that value.

Umanhonlen Gabriel, on medium.com

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 search input was rendered through a server-side template engine without being treated as plain data, so template syntax in the query was evaluated.

Impact

Because the server evaluates injected template expressions, an attacker could potentially escalate to remote code execution, though the text notes this depends on the backend engine.

What the attacker needed

None

How it was found

  1. Open the site and find the search bar, which sends the query as a GET parameter.
  2. Submit common template expressions and observe that most are returned as-is.
  3. Submit a multiplication expression in curly brackets and see the result reflected as the computed number.
  4. Repeat with a different multiplication expression, URL-encoded, and confirm the server evaluates it again.

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.

A template engine is software a website uses to build pages by filling in placeholders, and it can also do small calculations. Here the search box text was handed straight to that engine, so typing a calculation wrapped in curly brackets made the server work it out and show the answer. That means a user can control part of what the server runs, which can sometimes be pushed further to run commands.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.