{"id":"CVE-2026-33937","published":"2026-03-27T21:03:46Z","modified":"2026-09-04T12:04:45Z","title":"Handlebars.js has JavaScript Injection via AST Type Confusion","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, `Handlebars.compile()` accepts a pre-parsed AST object in addition to a template string. The `value` field of a `NumberLiteral` AST node is emitted directly into the generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST to `compile()` can therefore inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. Validate input type before calling `Handlebars.compile()`; ensure the argument is always a  `string`, never a plain object or JSON-deserialized value. Use the Handlebars runtime-only build (`handlebars/runtime`) on the server if templates are pre-compiled at build time; `compile()` will be unavailable.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.8,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.02084,"percentile":0.82048,"provenance":"source"},"cwes":[{"id":"CWE-843","name":"Access of Resource Using Incompatible Type"},{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-2w6w-674q-4c4q","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-33937","tags":["vdb-entry","x_refsource_REDHAT"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2452523","tags":["issue-tracking","x_refsource_REDHAT"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33937.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":28.3,"factors":[{"name":"EPSS percentile","points":16.41},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":6.86}]},"exploitSources":{"pocGithub":{"count":4,"skipped":0,"earliest":"2026-03-28","earliestUrl":"https://github.com/dinhvaren/cve-2026-33937","repos":[{"name":"EQSTLab/CVE-2026-33937","url":"https://github.com/EQSTLab/CVE-2026-33937","stars":3,"created":"2026-04-22"},{"name":"dinhvaren/cve-2026-33937","url":"https://github.com/dinhvaren/cve-2026-33937","stars":1,"created":"2026-03-28"},{"name":"c0gnit00/CVE-2026-33937","url":"https://github.com/c0gnit00/CVE-2026-33937","stars":1,"created":"2026-08-03"},{"name":"garlic-wizard/CVE-2026-33937-for-DarkZeroReturns","url":"https://github.com/garlic-wizard/CVE-2026-33937-for-DarkZeroReturns","stars":0,"created":"2026-07-30"}]},"first":{"date":"2026-03-28","source":"PoC-in-GitHub","url":"https://github.com/dinhvaren/cve-2026-33937"},"provenance":"source"},"vendorSlug":"handlebars-lang","affectedVersions":[{"vendor":"handlebars-lang","product":"handlebars.js","versions":[">= 4.0.0, < 4.7.9"]}],"ssvc":{"exploitation":"poc","automatable":"yes","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-2w6w-674q-4c4q"],"provenance":"source"}],"summary":{"text":"The flaw is in handlebars.js, in the Handlebars.compile() function, which in versions 4.0.0 through 4.7.8 accepts a pre-parsed AST object as well as a template string and emits the value of NumberLiteral nodes into generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST to compile() over the network, with no authentication or user interaction required, can inject and execute arbitrary JavaScript on the server, resulting in remote code execution.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-21T04:19:21Z"},"euvd":{"id":"EUVD-2026-16848","exploited":false,"provenance":"source"}}