Skip to content
RCE Advisory Intermediate CVE-2021-32819

GHSL-2021-023: Remote code execution in squirrelly - CVE-2021-32819

The squirrelly template engine mixes template data with configuration options when used with Express's render API, allowing an attacker to overwrite internal settings. This can lead to remote code execution in downstream applications that pass user-controlled query parameters directly to the render function.

agustingianni Follow

Originally disclosed on GitHub Security Lab

The Express render API was designed to only pass in template data. By allowing template engine configuration options to be passed through the Express render API directly, downstream users of an Express template engine may inadvertently introduce insecure behavior into their applications with impacts ranging from Cross…

agustingianni, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The template engine accepts configuration options through the same object used for template data, so user-controlled input can override internal settings.

Impact

This vulnerability leads to remote code execution.

What the attacker needed

Express app using squirrelly; passes user-controlled object to render

How it was found

  1. Set up an Express application using squirrelly as the view engine and pass req.query directly to res.render.
  2. Send a request with query parameters that include malicious configuration options.
  3. The engine processes the options and executes the injected code.

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 report has not been written yet. The Original tab links to the source.

Template engines help build web pages by filling in placeholders with data. Express, a web framework, lets you pass data to these engines. If the engine also accepts configuration settings from the same data, an attacker can change those settings to run their own code on the server.

What is RCE?

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

More by agustingianni

View all

24 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

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.