Skip to content

GHSA-q2c6-c6pm-g3gh

Arbitrary Code Execution in handlebars

High npm
Severity
High
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
—
Not classified
Fix
3.0.8
Upgrade handlebars to this version or later

Description

Versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a previous issue. This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).

Recommendation

Upgrade to version 3.0.8, 4.5.3 or later.

Affected versions

npm

PackageVulnerableFixed in
handlebars
< 3.0.8
3.0.8
handlebars
>= 4.0.0, < 4.5.3
4.5.3

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

handlebars npm → 3.0.8

npm
npm install handlebars@3.0.8
yarn
yarn add handlebars@3.0.8
pnpm
pnpm add handlebars@3.0.8

References

Timeline

  1. Published
  2. Last updated by the source
AdvisorySeverityWhy it's related
GHSA-8r5x-fm3f-whwj
Handlebars: JavaScript Injection via AST Type Confusion in compile (bypass of CVE-2026-33937)
Critical Also affects handlebars
GHSA-p8wg-vrv2-v86f
Handlebars: JavaScript Injection via Own Property Check Bypass
Critical Also affects handlebars
GHSA-xw65-4hp5-5hc7
Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
Medium Also affects handlebars
GHSA-7rx3-28cr-v5wh
Handlebars.js has a Prototype Method Access Control Gap via Missing __lookupSetter__ Blocklist Entry
Medium Also affects handlebars
GHSA-442j-39wm-28r2
Handlebars.js has a Property Access Validation Bypass in container.lookup
Low Also affects handlebars
GHSA-xjpj-3mr7-gcpf
Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options
High Also affects handlebars
GHSA-xhpv-hc6g-r9c6
Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial
High Also affects handlebars
GHSA-9cx6-37pm-9jff
Handlebars.js has Denial of Service via Malformed Decorator Syntax in Template Compilation
High Also affects handlebars
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor