cve.bz

CVE-2026-33940 handlebarsjs handlebars: Code Injection

8.1 highExploit referenceEPSS 0.7%Fix available

High (8.1) in handlebarsjs handlebars. EPSS 0.7% 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, 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.

Severity

CVSS 3.1

8.1 high
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
0.7% (unchanged from 0.7% a week ago; 0.8% 30 days ago) estimated probability of exploitation activity in the next 30 days; 55th 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-94 Improper Control of Generation of Code (Code Injection)
CWE-843 Access of Resource Using Incompatible Type (Type Confusion)
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-33940 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-33940?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-33940?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-33940 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-33940

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-33940](https://cve.bz/cve/badge/CVE-2026-33940.svg)](https://cve.bz/cve/CVE-2026-33940)

HTML:

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

Affected

Versions

From the NVD's CPE matches.

ProductAffected
handlebarsjs:handlebarsfrom 4.0.0 before 4.7.9

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-xhpv-hc6g-r9c6npmhandlebars>=4.0.0 <4.7.94.7.9

Linux distributions

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

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

This is an Important arbitrary code execution vulnerability in Handlebars.js. The flaw can be exploited when an application uses Handlebars.js with dynamic partial lookups and processes user-controlled data within the template context. Red Hat products bundling Handlebars.js are affected if they meet these specific conditions for exploitation.

Red Hat's mitigation

To mitigate this issue, use the runtime-only build of Handlebars.js, which prevents the fallback compilation path from being reached. Alternatively, sanitize all context data before rendering to ensure no non-primitive objects are passed to dynamic partials. Avoid dynamic partial lookups (`{{> (lookup ...)}}`) when context data is user-controlled. Implementing these mitigations may require application-level changes.

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 10firefoxNot affected
Red Hat Enterprise Linux 10thunderbirdAffected
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-33940.

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

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON