Handlebars arbitrary code execution via lookup helper

Severity: info · Published 2020-09-04

Handlebars is a popular templating engine used to dynamically generate web pages and emails. A vulnerability in the lookup helper allowed attackers to inject malicious code into templates, enabling arbitrary code execution on servers processing templates or in user browsers. This could lead to data theft, account compromise, or service compromise depending on deployment context.

Technologies: handlebars (npm). Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 4 September 2020.
Which products and versions are affected?
handlebars (npm) SEMVER:introduced=0,fixed=3.0.8.
Is there a fix for This vulnerability?
Yes. handlebars (npm): upgrade to 3.0.8 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run handlebars (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • handlebars (npm): upgrade to 3.0.8 or later
    npm install handlebars@3.0.8

Technical details

The vulnerability is an arbitrary code execution flaw in Handlebars' lookup helper, which failed to properly validate user-supplied templates. An incomplete fix for a prior issue left the helper susceptible to template injection attacks. An attacker could submit a crafted template that executes arbitrary JavaScript code. The attack vector depends on deployment: server-side processing enables code execution with server privileges; client-side rendering constitutes a cross-site scripting (XSS) vector. No authentication is required if the application accepts untrusted template input. Patches are available in versions 3.0.8, 4.5.3, and later.

Affected products

  • Handlebars Handlebars prior to 3.0.8 or 4.0.0 prior to 4.5.3

Timeline

  • 2020-09-04: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.