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

EPSS
0.05% (14th 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-15803086
  • published29 Mar 2026
  • disclosed27 Mar 2026
  • creditevanj2357

Introduced: 27 Mar 2026

NewCVE-2026-33940  (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 resolvePartial and invokePartial functions. An attacker can execute arbitrary code on the server by supplying a crafted object as a dynamic partial in the template context, which is then compiled and executed as JavaScript.

Note: This is only exploitable if the template uses dynamic partial lookups and the attacker can control the context property used for the lookup.

Workaround

This vulnerability can be mitigated by using the runtime-only build require('handlebars/runtime'), sanitizing context data to prevent non-primitive objects from being passed to dynamic partials, or avoiding dynamic partial lookups when context data is user-controlled.

CVSS Base Scores

version 4.0
version 3.1