CVE-2026-33941
Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options
Check your servers for CVE-2026-33941
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2026-33941 affects handlebars.js, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the Handlebars CLI precompiler (`bin/handlebars` / `lib/precompiler.js`) concatenates user-controlled strings — template file names and several CLI options — directly into the JavaScript it emits, without any escaping or sanitization. An attacker who can influence template filenames or CLI arguments can inject arbitrary JavaScript that executes when the generated bundle is loaded in Node.js or a browser. Version 4.7.9 fixes the issue. Some workarounds are available. First, validate all CLI inputs before invoking the precompiler. Reject filenames and option values that contain characters with JavaScript string-escaping significance (`"`, `'`, `;`, etc.). Second, use a fixed, trusted namespace string passed via a configuration file rather than command-line arguments in automated pipelines. Third, run the precompiler in a sandboxed environment (container with no write access to sensitive paths) to limit the impact of successful exploitation. Fourth, audit template filenames in any repository or package that is consumed by an automated build pipeline.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.26%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 10.9% of all scored CVEs. Scores of 30 Nov 2026.
The assessment of CISA (SSVC, 31 Mar 2026):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Weakness
- CWE-79 Improper Neutralization of Input During Web Page Generation
- CWE-94 Improper Control of Generation of Code
- CWE-116 Improper Encoding or Escaping of Output
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| handlebars.js |
affected >= 4.0.0, < 4.7.9
|
Is my server affected?
Find the installed version of handlebars.js and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i handlebars.js
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2026-33941 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2026-33941RHEL, Rocky, Alma, Fedora
rpm -q handlebars.js
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2026-33941Alpine
apk list --installed | grep -i handlebars.jsWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2026-33941
trivy image --scanners vuln IMAGE | grep CVE-2026-33941
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xjpj-3mr7-gcpf github.com
- https://access.redhat.com/security/cve/CVE-2026-33941 access.redhat.com · vdb entry
- RHBZ#2452524 bugzilla.redhat.com · issue tracking
- https://access.redhat.com/errata/RHSA-2026:34342 access.redhat.com · vendor advisory
- https://access.redhat.com/errata/RHSA-2026:10175 access.redhat.com · vendor advisory
Other references
- https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2 github.com
- https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9 github.com
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33941.json security.access.redhat.com
Source: the record CVE-2026-33941 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse