{"id":"CVE-2026-33938","published":"2026-03-27T21:05:42Z","modified":"2026-09-04T12:04:55Z","title":"Handlebars.js has JavaScript Injection via AST Type Confusion by tampering @partial-block","vendor":"handlebars-lang","product":"handlebars.js","tier":"tail","description":{"text":"Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the `@partial-block` special variable is stored in the template data context and is reachable and mutable from within a template via helpers that accept arbitrary objects. When a helper overwrites `@partial-block` with a crafted Handlebars AST, a subsequent invocation of `{{> @partial-block}}` compiles and executes that AST, enabling arbitrary JavaScript execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). The `compile()` method is  absent, eliminating the vulnerable fallback path. Second, audit registered helpers for any that write arbitrary values to context objects. Helpers  should treat context data as read-only. Third, avoid registering helpers from third-party packages (such as `handlebars-helpers`) in  contexts where templates or context data can be influenced by untrusted input.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00788,"percentile":0.57144,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"},{"id":"CWE-843","name":"Access of Resource Using Incompatible Type"},{"id":"CWE-917","name":"Improper Neutralization of Special Elements used in an Expression Language Statement"}],"references":[{"url":"https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-3mfm-83xf-c92r","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2","tags":["x_refsource_MISC"]},{"url":"https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9","tags":["x_refsource_MISC"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-33938","tags":["vdb-entry","x_refsource_REDHAT"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2452525","tags":["issue-tracking","x_refsource_REDHAT"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33938.json","tags":["x_sadp-csaf-vex"]},{"url":"https://access.redhat.com/errata/RHSA-2026:34342","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:10175","tags":["vendor-advisory","x_refsource_REDHAT"]}],"priority":{"score":17.1,"factors":[{"name":"EPSS percentile","points":11.43},{"name":"CVSS severity","points":5.67}]},"vendorSlug":"handlebars-lang","affectedVersions":[{"vendor":"handlebars-lang","product":"handlebars.js","versions":[">= 4.0.0, < 4.7.9"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2026-03-31T00:00:00+00:00","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"handlebars","vulnerableRanges":[">=4.0.0, <4.7.9"],"patched":["4.7.9"],"from":["GHSA-3mfm-83xf-c92r"],"provenance":"source"}],"euvd":{"id":"EUVD-2026-16849","exploited":false,"provenance":"source"}}