Skip to content
Tuesday, October 13, 2026AboutContactRSS
Vulnerabilities

Handlebars 4.7.9 AST Validation Bypassed in Critical Remote Code Execution Flaw

A critical vulnerability in the popular Handlebars templating engine allows attackers to inject arbitrary JavaScript by bypassing recent security controls.

Updated with new details.
Illustration: A shattered glass shield lies on the floor beside a tangled mess of colorful string art, with loose strands leaking out and forming sharp, jagged spikes that pierce t
AI-generated illustration: Threat Times

Key points

  • CVE-2026-106446 is rated critical severity and affects Handlebars versions 4.0.0 through 4.7.9.
  • The flaw bypasses AST validation introduced in version 4.7.9, allowing untrusted objects to execute code.
  • A patch is available in version 4.7.10 for affected users.

A critical remote code execution vulnerability has been identified in the Handlebars JavaScript templating engine, affecting versions 4.0.0 through 4.7.9. The flaw, tracked as CVE-2026-106446, allows attackers to bypass security validations added in the 4.7.9 release, potentially enabling the execution of arbitrary JavaScript code.

At a glance

Advisory
GHSA-8r5x-fm3f-whwj
CVE
CVE-2026-106446
Package
handlebars (npm)
Severity
Critical
Patched in
4.7.10

The vulnerability stems from incomplete validation of Abstract Syntax Trees (ASTs) passed to the `Handlebars.compile()` and `Handlebars.precompile()` functions. While version 4.7.9 introduced checks for specific node types—namely `PathExpression`, `NumberLiteral`, and `BooleanLiteral`—the compiler continues to write other AST values into the generated JavaScript without verification.

If an application passes an untrusted object, such as a parsed JSON request body, to these functions, that object can carry malicious JavaScript payloads. When using `compile()`, this code executes on the server during template rendering. With `precompile()`, the malicious code is embedded in the output and runs wherever that output is loaded.

Technical Details of the Bypass

The validation logic in version 4.7.9 operates within the `parseWithoutProcessing()` function, which traverses the entire AST. However, it only inspects values on nodes with specific types. It ignores plain objects lacking a `type` field, as well as strings and other non-object values. The compiler subsequently reads these unchecked values and inserts them directly into the generated code.

According to the GitHub advisory, several specific AST values are written into the generated code as-is:

  • `Program.blockParams.length` is written as `container.program(<index>, data, <length>)` under default options.
  • The `depth` property on parameters that are not `PathExpression` nodes, such as `StringLiteral`, is written as `depths[<depth>]` when the `stringParams` option is true.
  • A `StringLiteral.value` that is not a string is written as a raw JavaScript literal when `stringParams` is true.
  • A `PathExpression.original` that is not a string is written as a raw JavaScript literal when `stringParams` is true.

The first scenario works with default options. A `Program` object containing `blockParams` with a `length` property set to a JavaScript expression passes validation because the `blockParams` object lacks a `type` field, causing the type-specific checks to be skipped. This flaw bypasses the AST validation added in 4.7.9 to address previous issues, including GHSA-2w6w-674q-4c4q, GHSA-xhpv-hc6g-r9c6, and GHSA-3mfm-83xf-c92r.

Who Is Affected

Applications that exclusively pass template strings to Handlebars are not affected by this vulnerability. The risk exists only when applications pass pre-parsed AST objects or untrusted data structures that resemble ASTs to the compilation functions. Developers who accept user input and parse it into an object before passing it to `compile()` or `precompile()` are potentially exposed.

What should you do?

Users of the Handlebars npm package should update to version 4.7.10 immediately, as this version contains the fix for CVE-2026-106446. Organizations should audit their codebases to identify any instances where untrusted objects are passed to `Handlebars.compile()` or `Handlebars.precompile()`. If immediate updates are not possible, ensure that only trusted template strings are used in these functions.

What to do and how to stay safe: Handlebars

  • Patch scores alone ignore context like network exposure and asset criticality.
  • You must map vulnerabilities to specific business risks to prioritize correctly.
  • Continuous exposure data replaces static scanning for accurate prioritization.

Prioritize vulnerabilities by actual exploitability and business impact, not by theoretical severity scores. Update your asset context and exposure data continuously to maintain accurate risk rankings.

Step-by-step guide: Risk Based Vulnerability Management: Prioritize Fixes by Actual Threat

General security guidance from the Threat Times newsroom. It is not confirmed advice from the organisations named in this story.

Frequently asked questions

Which versions of Handlebars are vulnerable to CVE-2026-106446?

Handlebars versions 4.0.0 through 4.7.9 are vulnerable. Version 4.7.10 patches the issue.

Does this vulnerability affect applications that only use template strings?

No, applications that only ever pass template strings to the compiler are not affected.

What is the severity rating of this vulnerability?

The vulnerability is rated as critical severity.

Sources

  1. GitHub Advisory Database
Related articles