Skip to main content

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

0
Critical
VulnerabilityCVE-2026-106446cvecve-2026-106446cwe-94cwe-843
Published: 10/06/2026 (10/06/2026, 19:41:55 UTC)
Source: CVE Database V5
Vendor/Project: handlebars-lang
Product: 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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected software

handlebars-lang

handlebars.js

Affected versions
>=4.0.0 <4.7.10
handlebars
pkg:npm/handlebars

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

AILast updated: 10/06/2026, 20:03:38 UTC

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.

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-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 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