Zero Day MonitorZDM
DashboardVulnerabilitiesTrendingZero-DaysNews
Login
ImpressumPrivacy Policy
Zero Day Monitor © 2026
2327 articles · 106041 vulns · 38/41 feeds (7d)
← Back to list
8.1
CVE-2026-33940PATCHED
handlebars-lang · handlebars.js

Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial

Description

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, a crafted object placed in the template context can bypass all conditional guards in `resolvePartial()` and cause `invokePartial()` to return `undefined`. The Handlebars runtime then treats the unresolved partial as a source that needs to be compiled, passing the crafted object to `env.compile()`. Because the object is a valid Handlebars AST containing injected code, the generated JavaScript executes arbitrary commands on the server. The attack requires the adversary to control a value that can be returned by a dynamic partial lookup. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). Without `compile()`, the fallback compilation path in `invokePartial` is unreachable. Second, sanitize context data before rendering: Ensure no value in the context is a non-primitive object that could be passed to a dynamic partial. Third, avoid dynamic partial lookups (`{{> (lookup ...)}}`) when context data is user-controlled.

Affected Products

VendorProductVersions
handlebars-langhandlebars.jsnpm/handlebars: >= 4.0.0, <= 4.7.8

References

  • https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xhpv-hc6g-r9c6(x_refsource_CONFIRM)
  • https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2(x_refsource_MISC)
  • https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9(x_refsource_MISC)

Related News (3 articles)

Tier A
Microsoft MSRC4h ago
CVE-2026-33940 Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial
→ No new info (linked only)
Tier C
VulDB3d ago
CVE-2026-33940 | Handlebars up to 4.7.8 env.compile code injection (GHSA-xhpv-hc6g-r9c6)
→ No new info (linked only)
Tier C
VulDB3d ago
CVE-2026-33940 | Handlebars up to 4.7.8 env.compile code injection (GHSA-xhpv-hc6g-r9c6)
→ No new info (linked only)
CVSS 3.18.1 HIGH
VectorCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CISA KEV❌ No
Actively exploited❌ No
Patch availablehandlebars@4.7.9
CWECWE-94, CWE-843
PublishedMar 27, 2026
Last enriched3d agov2
Tags
GHSA-xhpv-hc6g-r9c6npm
Trending Score52
Source articles3
Independent2
Info Completeness9/14
Missing: epss, kev, exploit, iocs, mitre_attack

Community Vote

0
Login to vote
0 upvotes0 downvotes
No votes yet

Related CVEs (5)

HIGHCVE-2026-33939EXP
Handlebars.js has Denial of Service via Malformed Decorator Syntax in Template Compilation
Trending: 76
CRITICALCVE-2026-33938EXP
Handlebars.js has JavaScript Injection via AST Type Confusion by tampering @partial-block
Trending: 61
MEDIUMCVE-2026-33916
Handlebars.js has Prototype Pollution Leading to XSS through Partial Template Injection
Trending: 42
CRITICALCVE-2026-33937
Handlebars.js has JavaScript Injection via AST Type Confusion
Trending: 42
HIGHCVE-2026-33941
Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options
Trending: 39

Pin to Dashboard

Verification

State: unverified
Confidence: 0%

Vulnerability Timeline

CVE Published
Mar 27, 2026
Discovered by ZDM
Mar 27, 2026
Updated: severity, patchAvailable
Mar 27, 2026
Patch Available
Mar 30, 2026

Version History

v2
Last enriched 3d ago
v2Tier C3d ago

Updated severity to CRITICAL and corrected exploit availability to false.

severitypatchAvailable
via VulDB
v13d ago

Initial creation