CVE-2026-33940
Last modified
CVE-2026-33940 is a high-severity vulnerability rated 8.1/10 on the CVSS scale. 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`. EPSS estimates a 0.70% chance of exploitation in the next 30 days.
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.
Metrics
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness Enumeration
Affected Software
| Vendor | Product | Versions |
|---|---|---|
| Handlebarsjs | Handlebars | >= 4.0.0, < 4.7.9 |
References
- https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xhpv-hc6g-r9c6Exploit, Vendor Advisory
Timeline
- Published
- Last Modified
- Status
- Modified
Frequently Asked Questions
What is CVE-2026-33940?
How severe is CVE-2026-33940?
How do I fix CVE-2026-33940?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2026
- CVE-2026-33935MyTube is a self-hosted downloader and player for several vi…7.5
- CVE-2026-33936The `ecdsa` PyPI package is a pure Python implementation of …5.3
- CVE-2026-33937Handlebars provides the power necessary to let users build s…9.8
- CVE-2026-33938Handlebars provides the power necessary to let users build s…8.1
- CVE-2026-33939Handlebars provides the power necessary to let users build s…7.5
- CVE-2026-3394A vulnerability was detected in jarikomppa soloud up to 2020…7.8
- CVE-2026-33941Handlebars provides the power necessary to let users build s…8.2
- CVE-2026-33942Saloon is a PHP library that gives users tools to build API …9.8
- CVE-2026-33943Happy DOM is a JavaScript implementation of a web browser wi…9.8
- CVE-2026-33945Incus is a system container and virtual machine manager. Inc…9.6
- CVE-2026-33946MCP Ruby SDK is the official Ruby SDK for Model Context Prot…5.9
- CVE-2026-33947jq is a command-line JSON processor. In versions 1.8.1 and b…5.5
Are you affected by CVE-2026-33940?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
