Track vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
9.8

CVE-2026-33937: Handlebars templates allow attacker to run code

CVE-2026-33937 · published 8 months ago
Summary

Versions of Handlebars from 4.0.0 through 4.7.8 let a specially crafted template object insert JavaScript directly into the server. This can let an attacker execute any code they choose, potentially taking over the server. Upgrade to version 4.7.9 or later, and make sure only string templates are passed to the compile function, or use the runtime‑only build when possible.

What to do
  • Update jaylinski handlebars to version 4.7.9.
  • Update rootio @rootio/handlebars to version 4.7.8-root.io.4.
  • Update rootio @rootio/handlebars to version 4.7.8-root.io.5.
  • Update rootio @rootio/handlebars to version 4.7.7-root.io.1.
  • Update rootio @rootio/handlebars to version 4.7.8-root.io.6.
  • Update jaylinski handlebars to version 4.7.8-aikido.6.
  • Update jaylinski handlebars to version 4.7.7-aikido.3.
  • Update rootio @rootio/handlebars to version 4.7.7-root.io.3.
  • Update handlebars to version 4.7.7-aikido.5.
  • Update rootio @rootio/handlebars to version 4.7.7-root.io.5.
  • Update handlebarsjs handlebars to version 4.7.9 or later.
Affected software
Ecosystem VendorProductAffected versions
npm jaylinski handlebars >= 4.0.0, <= 4.7.8
Fix: upgrade to 4.7.9
Debian:11 debian node-handlebars All versions
Debian:12 debian node-handlebars All versions
Debian:13 debian node-handlebars All versions
Debian:14 debian node-handlebars All versions
– handlebarsjs handlebars >= 4.0.0, < 4.7.9
cpe:2.3:a:handlebarsjs:handlebars:*:*:*:*:*:node.js:*:*
Root:npm rootio @rootio/handlebars < 4.7.8-root.io.4
< 4.7.8-root.io.5
< 4.7.7-root.io.1
< 4.7.8-root.io.6
< 4.7.7-root.io.3
< 4.7.7-root.io.5
Fix: upgrade to 4.7.8-root.io.4
Root:npm jaylinski handlebars < 4.7.8-aikido.6
< 4.7.7-aikido.3
Fix: upgrade to 4.7.8-aikido.6
– handlebars-lang handlebars.js >= 4.0.0, < 4.7.9
Root:npm – handlebars < 4.7.7-aikido.5
Fix: upgrade to 4.7.7-aikido.5
Ubuntu:18.04:LTS canonical node-handlebars All versions
Original advisory text
CVE-2026-33937 in handlebars - Patched by Root
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, `Handlebars.compile()` accepts a pre-parsed AST object in addition to a template string. The `value` field of a `NumberLiteral` AST node is emitted directly into the generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST to `compile()` can therefore inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. Validate input type before calling `Handlebars.compile()`; ensure the argument is always a `string`, never a plain object or JSON-deserialized value. Use the Handlebars runtime-only build (`handlebars/runtime`) on the server if templates are pre-compiled at build time; `compile()` will be unavailable.
Fix within
Internet-facing 3 days
Internal 60 days
  • Not known to be exploited
  • Can be exploited automatically
  • Gives an attacker full control
Severity
9.8 Critical
Exploitation
2% chance of attack within 30 days
Type
CWE-94Code Injection
CWE-843Type Confusion
Timeline
Published27 Mar 2026
Updated2 Dec 2026
First seen27 Mar 2026
Track software like this
Free during beta