CVE-2026-106446: CWE-94: Improper Control of Generation of Code ('Code Injection') in handlebars-lang handlebars.js
Description
A critical code injection vulnerability exists in handlebars.js versions 4.0.0 through 4.7.9. The issue arises because Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects but validate only selected literal values, allowing attackers who can supply an object instead of a template string to inject JavaScript expressions. This leads to remote code execution in the server process when the compiled template is rendered or precompiled output is loaded. The vulnerability is fixed in version 4.7.10.
CVSS v3.1
Score 9.8critical
Affected software
handlebars-lang
handlebars.js
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Handlebars.js versions 4.0.0 to 4.7.9 contain a code injection vulnerability (CWE-94) due to improper control of code generation. The functions Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects but only validate certain PathExpression, NumberLiteral, and BooleanLiteral values. This incomplete validation allows an attacker who can supply an object instead of a template string to inject malicious JavaScript expressions into unchecked AST fields such as Program.blockParams.length, non-PathExpression parameter depth, non-string StringLiteral.value, or non-string PathExpression.original. The injected code is emitted into the generated JavaScript, resulting in code execution in the server process during template rendering or precompile output loading. Applications that only pass template strings are not affected. The issue was addressed and fixed in version 4.7.10.
Potential Impact
Successful exploitation allows an unauthenticated attacker who can supply a crafted object instead of a template string to achieve remote code execution on the server process running Handlebars.js. This can lead to full compromise of the affected system, including confidentiality, integrity, and availability impacts. The vulnerability has a CVSS 3.1 score of 9.8 (critical), indicating high severity with network attack vector, no privileges required, and no user interaction needed.
Mitigation Recommendations
Upgrade handlebars.js to version 4.7.10 or later, where this vulnerability is fixed. Applications that only pass template strings to Handlebars.compile() or Handlebars.precompile() are not affected. There are no other mitigations noted. Patch status is confirmed fixed in 4.7.10.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-10-06T16:49:40.590Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6ac550de2cdf04f656d8a129
Added to database: 10/06/2026, 19:49:50 UTC
Last enriched: 10/06/2026, 20:03:38 UTC
Last updated: 10/06/2026, 20:28:32 UTC
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
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
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.