CVE-2026-106446

Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)

Published Oct 6, 2026 CVSS 3.1 · 9.8 Critical EPSS < 1% KEV · Not listed
Description
Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.

Analysis

AI-generated

Technical impact

Handlbars.compile and precompile can accept a JavaScript object that represents a parsed template. The vendor only validates a narrow set of node types, leaving unvalidated fields such as Program.blockParams.length, non‑PathExpression depth, non‑string StringLiteral.value, or non‑string PathExpression.original to propagate. Those values are interpolated into the generated JavaScript code. An attacker who can supply such an object can cause arbitrary code execution in the Node.js process that runs the generated template or loads the precompiled bundle. The 9.8 CVSS score reflects the complete loss of confidentiality, integrity and availability. The vulnerability stems from type confusion (CWE‑843) and code injection (CWE‑94).

Affected Systems

Any deployment of Handlebars.js from version 4.0.0 up through, but not including, 4.7.10 is vulnerable. The fix was introduced in 4.7.10, so that release or any newer release is not affected. Applications that only pass raw template strings are not impacted, because the vulnerability requires an object input.

Risk and Exploitability

The exploit hinges on supplying a crafted AST object to the compile or precompile function. This is possible when the application accepts external template definitions or precompiled bundles. Once the object is processed, the injected JavaScript runs in the same context as the server, giving full control. The EPSS score is not published, but the 9.8 CVSS score and the absence from the CISA KEV list still indicate a serious threat. The likely attack vector is the compile/precompile APIs, which accept objects rather than strings.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Handlebars.js to 4.7.10 or later.
  • If an upgrade is not immediately possible, reject any non‑string inputs to Handlebars.compile() or Handlebars.precompile(); enforce that only plain template strings are accepted.
  • When using precompiled templates, verify they come from trusted sources and that any blockParams or PathExpression attributes are validated to be strings before loading the bundle.

Generated by OpenCVE AI on October 7, 2026 at 01:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-8r5x-fm3f-whwj Handlebars: JavaScript Injection via AST Type Confusion in compile (bypass of CVE-2026-33937)
History
Type Values Removed Values Added
First Time appeared Handlebarsjs
Handlebarsjs handlebars
Vendors & Products Handlebarsjs
Handlebarsjs handlebars
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.
Title Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)
Weaknesses CWE-843
CWE-94
References
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-843

    Access of Resource Using Incompatible Type ('Type Confusion')

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 7, 2026, 6:30 PM
Reserved
Oct 6, 2026, 4:49 PM
Status
Awaiting Analysis
Published
Oct 6, 2026, 8:17 PM
Modified
Oct 7, 2026, 7:17 PM
Severity
Important
Public date
Oct 6, 2026, 7:41 PM