cve.bz

CVE-2026-33941 handlebarsjs handlebars: Cross-site Scripting

8.2 highExploit referenceEPSS 0.3%Fix available

High (8.2) in handlebarsjs handlebars. EPSS 0.3% estimated probability of exploitation activity in the next 30 days. Fixed in handlebars 4.7.9.

On this page
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 3.1

8.2 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
EPSS
0.3% (unchanged from 0.3% a week ago; 0.2% 30 days ago) estimated probability of exploitation activity in the next 30 days; 23rd percentile. Scored 2026-11-15. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: PoC · Automatable: no · Technical impact: total, assessed 2026-03-31. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-79 Improper Neutralization of Input During Web Page Generation (Cross-site Scripting)
CWE-94 Improper Control of Generation of Code (Code Injection)
CWE-116 Improper Encoding or Escaping of Output
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2026-33941 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-33941?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-33941?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-33941 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Badge for a README or a site

CVE-2026-33941

An image that stays current: it is drawn from the data each time it is fetched (a host that proxies images, as GitHub does, may show its copy for a while). Markdown:

[![CVE-2026-33941](https://cve.bz/cve/badge/CVE-2026-33941.svg)](https://cve.bz/cve/CVE-2026-33941)

HTML:

<a href="https://cve.bz/cve/CVE-2026-33941"><img src="https://cve.bz/cve/badge/CVE-2026-33941.svg" alt="CVE-2026-33941"></a>

Affected

Versions

From the NVD's CPE matches.

ProductAffected
handlebarsjs:handlebarsfrom 4.0.0 before 4.7.9

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-xjpj-3mr7-gcpfnpmhandlebars>=4.0.0 <4.7.94.7.9

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12, 13node-handlebarsno fix listedDEBIAN-CVE-2026-33941
Debian14node-handlebars3:4.7.9-1DEBIAN-CVE-2026-33941
Ubuntu18.04:LTS, 20.04:LTS, 22.04:LTS and 4 morenode-handlebarsno fix listedUBUNTU-CVE-2026-33941

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu.

Red Hat

Red Hat rates this Important.

Red Hat's statement

Important: This flaw in Handlebars allows arbitrary code execution when the CLI precompiler processes untrusted inputs. An attacker who can influence template filenames or command-line arguments can inject malicious JavaScript, which executes when the generated bundle is loaded. Red Hat products utilizing the Handlebars CLI precompiler in environments where untrusted inputs are processed may be affected.

Red Hat's mitigation

To mitigate this issue, ensure all inputs to the Handlebars CLI precompiler are thoroughly validated, rejecting characters with JavaScript string-escaping significance (e.g., \" , \' , ;). For automated build pipelines, configure a fixed and trusted namespace string via a configuration file rather than passing it through command-line arguments. Additionally, consider running the precompiler within a sandboxed environment, such as a container with restricted write access, to limit the potential impact of successful exploitation.

ProductPackageStateAdvisory
Cluster Observability Operator 1.5.3cluster-observability-operator/logging-console-plugin-pf4-rhel9:1782839279Fixed 2026-07-01RHSA-2026:34342
Cluster Observability Operator 1.5.3cluster-observability-operator/logging-console-plugin-pf5-rhel9:1782840539Fixed 2026-07-01RHSA-2026:34342
Cluster Observability Operator 1.5.3cluster-observability-operator/troubleshooting-panel-console-plugin-pf6-rhel9:1782839996Fixed 2026-07-01RHSA-2026:34342
Red Hat OpenShift Dev Spaces 3.27devspaces/code-rhel9:1776744110Fixed 2026-04-23RHSA-2026:10175
Cryostat 4handlebarsNot affected
Logging Subsystem for Red Hat OpenShiftopenshift-logging/elasticsearch6-rhel9Will not fix
Logging Subsystem for Red Hat OpenShiftopenshift-logging/elasticsearch-operator-bundleWill not fix
Logging Subsystem for Red Hat OpenShiftopenshift-logging/elasticsearch-proxy-rhel9Will not fix
Logging Subsystem for Red Hat OpenShiftopenshift-logging/elasticsearch-rhel9-operatorWill not fix
Logging Subsystem for Red Hat OpenShiftopenshift-logging/kibana6-rhel8Will not fix
Logging Subsystem for Red Hat OpenShiftopenshift-logging/logging-curator5-rhel9Will not fix
Red Hat Data Grid 8handlebarsNot affected
Red Hat Developer Hub 1rhdh/rhdh-hub-rhel9Not affected
Red Hat Enterprise Linux 10firefoxAffected
Red Hat Enterprise Linux 10thunderbirdNot affected
Red Hat Enterprise Linux 7firefoxNot affected
Red Hat Enterprise Linux 8389-ds:1.4/389-ds-baseWill not fix
Red Hat Enterprise Linux 8firefoxNot affected
Red Hat Enterprise Linux 8grafanaNot affected
Red Hat Enterprise Linux 8mozjs60Not affected
5 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2026-33941.

Attack patterns (CAPEC)

  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-77 Manipulating User-Controlled Variables Likelihood: High · Severity: Very High
  • CAPEC-242 Code Injection Likelihood: High · Severity: High
  • CAPEC-73 User-Controlled Filename Likelihood: High · Severity: High
  • CAPEC-81 Web Server Logs Tampering Likelihood: Medium · Severity: High
  • CAPEC-85 AJAX Footprinting Likelihood: High · Severity: Low
  • CAPEC-104 Cross Zone Scripting Likelihood: Medium · Severity: High
  • CAPEC-63 Cross-Site Scripting (XSS) Likelihood: High · Severity: Very High
  • CAPEC-209 XSS Using MIME Type Mismatch Severity: Medium
  • CAPEC-588 DOM-Based XSS Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits. More on the page of CWE-79.

References

Check your stackJSON