Skip to content
Info disclosure Advisory Intermediate

GHSL-2021-022: Remote code execution in whiskers

The whiskers template engine mixes template data with engine configuration options when used through the Express render API. If an application passes user-controlled query parameters directly to res.render, an attacker can override settings such as the views directory and partials to read arbitrary files.

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

Likely the whiskers engine does not separate template data from configuration options, so user-supplied keys can override internal settings such as the views directory and partials.

Impact

This vulnerability leads to arbitrary file disclosure.

What the attacker needed

Application passes user-controlled object to res.render; template uses partials

How it was found

  1. Set up an Express app that uses whiskers and passes req.query directly to res.render.
  2. Create a template that includes a partial.
  3. Send a request with query parameters that override the views setting and define a partial pointing to a sensitive file.
  4. The response discloses the contents of the targeted file.

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.

A template engine fills in placeholders in a web page. The Express framework lets you pass data to the engine, but whiskers also accepts configuration settings in that same data. If a website passes user input straight into the render function, an attacker can change those settings to make the engine read files from the server, like a password file.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.