Access of Resource Using Incompatible Type ('Type Confusion') Affecting handlebars package, versions >=4.0.0 <4.7.9


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.25% (49th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Access of Resource Using Incompatible Type ('Type Confusion') vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-HANDLEBARS-15803084
  • published29 Mar 2026
  • disclosed27 Mar 2026
  • creditRealHurrison

Introduced: 27 Mar 2026

NewCVE-2026-33937  (opens in a new tab)
CWE-1321  (opens in a new tab)
CWE-843  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade handlebars to version 4.7.9 or higher.

Overview

handlebars is an extension to the Mustache templating language.

Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') via the compile function. An attacker can execute arbitrary code by supplying a crafted Abstract Syntax Tree (AST) object with a malicious NumberLiteral value, which is emitted directly into generated JavaScript code without proper sanitization.

Note: This allows the attacker to inject and run arbitrary commands on the server. This is only exploitable if user-controlled JSON is deserialized and passed directly to the compile function.

Workaround

This vulnerability can be mitigated by validating that the input to the compile function is always a string and not a plain object or JSON-deserialized value, or by using the runtime-only build where compile is unavailable.

CVSS Base Scores

version 4.0
version 3.1