Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-33938: CWE-94: Improper Control of Generation of Code ('Code Injection') in handlebars-lang handlebars.js

0
High
VulnerabilityCVE-2026-33938cvecve-2026-33938cwe-94cwe-843
Published: Fri Mar 27 2026 (03/27/2026, 21:05:42 UTC)
Source: CVE Database V5
Vendor/Project: handlebars-lang
Product: handlebars.js

Description

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the `@partial-block` special variable is stored in the template data context and is reachable and mutable from within a template via helpers that accept arbitrary objects. When a helper overwrites `@partial-block` with a crafted Handlebars AST, a subsequent invocation of `{{> @partial-block}}` compiles and executes that AST, enabling arbitrary JavaScript execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). The `compile()` method is absent, eliminating the vulnerable fallback path. Second, audit registered helpers for any that write arbitrary values to context objects. Helpers should treat context data as read-only. Third, avoid registering helpers from third-party packages (such as `handlebars-helpers`) in contexts where templates or context data can be influenced by untrusted input.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 04/04/2026, 10:49:24 UTC

Technical Analysis

Handlebars.js versions 4.0.0 to 4.7.8 contain a vulnerability where the @partial-block special variable is accessible and mutable within templates via helpers that accept arbitrary objects. If a helper overwrites @partial-block with a malicious Handlebars AST, a subsequent invocation of {{> @partial-block}} compiles and executes that AST, enabling arbitrary server-side JavaScript execution. This is a code injection vulnerability classified under CWE-94 and CWE-843. The vulnerability is addressed in version 4.7.9. Mitigations include using the runtime-only build which lacks the compile() method, auditing helpers to ensure they treat context data as read-only, and avoiding third-party helpers in contexts influenced by untrusted input.

Potential Impact

Successful exploitation allows an attacker to execute arbitrary JavaScript code on the server, potentially leading to full server compromise, data theft, or service disruption. The CVSS score of 8.1 (high) reflects the network attack vector, no privileges required, no user interaction, and high impact on confidentiality, integrity, and availability.

Mitigation Recommendations

An official fix is available in handlebars.js version 4.7.9; upgrading to this version is recommended. If immediate upgrade is not possible, use the runtime-only build (require('handlebars/runtime')) which removes the vulnerable compile() method. Additionally, audit all registered helpers to ensure they do not mutate context data, especially the @partial-block variable. Avoid registering helpers from third-party packages in environments where templates or context data can be influenced by untrusted input.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-03-24T19:50:52.103Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 69c6f3473c064ed76ff618a6

Added to database: 3/27/2026, 9:14:47 PM

Last enriched: 4/4/2026, 10:49:24 AM

Last updated: 5/11/2026, 6:29:27 AM

Views: 80

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses