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 | Vendor | Product | Affected 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.
References
- https://security-tracker.debian.org/tracker/CVE-2026-33937 Vendor Advisory
- https://access.redhat.com/errata/RHSA-2026:34342
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33937.json
- https://access.redhat.com/errata/RHSA-2026:10175
- https://github.com/advisories/GHSA-2w6w-674q-4c4q
- https://ubuntu.com/security/CVE-2026-33937 Third Party Advisory
- https://www.cve.org/CVERecord?id=CVE-2026-33937 Third Party Advisory
- https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c... Third Party Advisory
- https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/33xxx/CVE-2026-33937... Vendor Advisory
- https://nvd.nist.gov/vuln/detail/CVE-2026-33937 Vendor Advisory
- https://access.redhat.com/security/cve/CVE-2026-33937
- https://bugzilla.redhat.com/show_bug.cgi?id=2452523
- https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9 Third Party Advisory
- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-2w6w-6... Third Party Advisory
Internet-facing
3 days
Internal
60 days
- Not known to be exploited
- Can be exploited automatically
- Gives an attacker full control
Type
CWE-94Code Injection
CWE-843Type Confusion
Timeline
Published27 Mar 2026
Updated2 Dec 2026
First seen27 Mar 2026
Sources
GHSA-2w6w-674q-4c4q · GHSA
CVE-2026-33937 · NVD
DEBIAN-CVE-2026-33937 · OSV
CVE-2026-33937 · MITRE
UBUNTU-CVE-2026-33937 · OSV
CVE-2026-33937 · OSV
Track software like this
Free during beta