Skip to content
XSS Advisory Intermediate

GHSL-2021-024: Reflected Cross Site Scripting in eta

The eta template engine mixes template data with engine configuration options when used through the Express render API. An attacker could disable HTML escaping by passing a configuration option, leading to reflected cross-site scripting in applications that pass user-controlled request objects directly to the renderer.

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

Impact

A vulnerable application that passes user-controlled request objects to the eta template engine may introduce reflected XSS vulnerabilities by allowing an attacker to disable any intended HTML escape functionality.

What the attacker needed

Application uses eta with Express; Application passes user-controlled object to render; No other input validation

The fix

The maintainer added documentation illustrating the vulnerable pattern, but the text does not state that the code was fixed.

How it was found

  1. Set up an Express application using eta as the view engine and pass req.query directly to res.render.
  2. Create a template that outputs a user-supplied message without additional escaping.
  3. Send a request with a script payload in the message parameter and a setting to disable auto-escaping.
  4. Observe that the script executes in the response, demonstrating reflected XSS.

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 fill in placeholders in web pages. Express lets you pass data to these engines, but eta also accepts configuration settings in the same object. If an application passes user input directly, an attacker can change settings, such as turning off automatic escaping of HTML, and inject malicious scripts.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

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.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.