CVE-2026-33940Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as…
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, a crafted object placed in the template context can bypass all conditional guards in `resolvePartial()` and cause `invokePartial()` to return `undefined`. The Handlebars runtime then treats the unresolved partial as a source that needs to be compiled, passing the crafted object to `env.compile()`. Because the object is a valid Handlebars AST containing injected code, the generated JavaScript executes arbitrary commands on the server. The attack requires the adversary to control a value that can be returned by a dynamic partial lookup. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). Without `compile()`, the fallback compilation path in `invokePartial` is unreachable. Second, sanitize context data before rendering: Ensure no value in the context is a non-primitive object that could be passed to a dynamic partial. Third, avoid dynamic partial lookups (`{{> (lookup ...)}}`) when context data is user-controlled.
What to do
Fixed builds are available from Debian, npm: see the table below for the fixed version per release.
Debian, Red Hat, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | node-handlebars | Fix pending | UBUNTU-CVE-2026-33940 | |
| Ubuntu 26.04 | node-handlebars | Under investigation | UBUNTU-CVE-2026-33940 | |
| Ubuntu 25.10 | node-handlebars | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2026-33940 | |
| Ubuntu 24.04 | node-handlebars | Under investigation | UBUNTU-CVE-2026-33940 | |
| Ubuntu 22.04 | node-handlebars | Under investigation | UBUNTU-CVE-2026-33940 | |
| Ubuntu 20.04 | node-handlebars | Fix pending | UBUNTU-CVE-2026-33940 | |
| Ubuntu 18.04 | node-handlebars | Fix pending | UBUNTU-CVE-2026-33940 | |
| Debian 14 | node-handlebars | Fixed | 3:4.7.9-1 | DEBIAN-CVE-2026-33940 |
| Debian 13 | node-handlebars | Fix pending | DEBIAN-CVE-2026-33940 | |
| Debian 12 | node-handlebars | Fix pending | DEBIAN-CVE-2026-33940 | |
| Red Hat Enterprise Linux 10 | firefox | Not affected | ||
| Red Hat Enterprise Linux 10 | thunderbird | Fix pending Affected | ||
| Red Hat Enterprise Linux 9 | firefox | Fix pending Affected | ||
| Red Hat Enterprise Linux 9 | firefox-x11 | Fix pending Affected | ||
| Red Hat Enterprise Linux 9 | thunderbird | Not affected | ||
| Red Hat Enterprise Linux 8 | 389-ds-base | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | 389-ds-base-devel | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | 389-ds-base-legacy-tools | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | 389-ds-base-libs | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | 389-ds-base-snmp | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | cockpit-389-ds | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | firefox | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-azure-monitor | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-cloudwatch | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-elasticsearch | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-graphite | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-influxdb | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-loki | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-mssql | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-mysql | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-opentsdb | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-postgres | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-prometheus | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-selinux | Not affected | ||
| Red Hat Enterprise Linux 8 | grafana-stackdriver | Not affected | ||
| Red Hat Enterprise Linux 8 | mozjs60 | Not affected | ||
| Red Hat Enterprise Linux 8 | mozjs60-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | python3-lib389 | Will not fix Will not fix | ||
| Red Hat Enterprise Linux 8 | thunderbird | Not affected | ||
| Red Hat Enterprise Linux 7 | firefox | Not affected | ||
| npm library | handlebars | Fixed | 4.7.9 | GHSA-xhpv-hc6g-r9c6 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- handlebars-lang handlebars.js: affected: >= 4.0.0, < 4.7.9
References
- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xhpv-hc6g-r9c6
- https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2
- https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.