Skip to content
The RedTeam Monitor
Wednesday, October 21, 2026Your daily threat briefing239 reports
Handlebars 4.7.10 Released to Fix Critical RCE Vulnerability in Versions 4.0.0-4.7.9
Vulnerabilities

Handlebars 4.7.10 Released to Fix Critical RCE Vulnerability in Versions 4.0.0-4.7.9

A critical remote code execution vulnerability in the Handlebars template engine allows attackers to inject arbitrary JavaScript via manipulated AST objects.

Key points

  • Versions 4.0.0 through 4.7.9 of the npm handlebars package are vulnerable to CVE-2026-106446.
  • The flaw bypasses security checks added in version 4.7.9, allowing untrusted data to execute as code.
  • Version 4.7.10 has been released to patch the issue; applications using only template strings are unaffected.

Security researchers have identified a critical remote code execution (RCE) vulnerability in the widely used Handlebars template engine. The flaw, tracked as CVE-2026-106446, affects all versions from 4.0.0 up to and including 4.7.9. A patched version, 4.7.10, is now available to address the security gap.

The vulnerability arises from incomplete validation of Abstract Syntax Tree (AST) objects. While version 4.7.9 introduced checks for specific node types, it failed to validate other values that the compiler writes directly into generated JavaScript code. This oversight allows attackers to inject arbitrary code if an application passes untrusted data—such as a parsed JSON request body—to the `compile()` or `precompile()` functions.

In plain English

Handlebars is a tool that developers use to create HTML templates by merging data with predefined structures. To prevent malicious code injection, version 4.7.9 added a safety check. However, this check was incomplete. It only inspected certain parts of the data structure while ignoring others.

Attackers can exploit this by sending a specially crafted data object to the application. Because the safety check misses these specific parts, the application accepts the malicious data. When the template is rendered, the injected JavaScript executes. If the application uses the `compile()` function, the code runs on the server. If it uses `precompile()`, the malicious code is embedded in the output and runs wherever that output is loaded.

The background

The vulnerability bypasses fixes for three previous security advisories: GHSA-2w6w-674q-4c4q, GHSA-xhpv-hc6g-r9c6, and GHSA-3mfm-83xf-c92r. The validator in version 4.7.9 only checked values on nodes identified as `PathExpression`, `NumberLiteral`, or `BooleanLiteral`.

It overlooked plain objects without a defined type, as well as strings and other non-object values. The compiler reads these unchecked values and inserts them into the generated code as-is. For example, a `Program` object with a manipulated `blockParams` length can pass validation because the object lacks a type field, triggering no specific checks. This allows arbitrary JavaScript expressions to be executed with default compile options.

What changes now

Organisations using Handlebars versions between 4.0.0 and 4.7.9 must upgrade to version 4.7.10 immediately. The update ensures that all AST values are properly validated before being written into generated code.

Applications that exclusively pass template strings to Handlebars are not affected by this vulnerability. The risk exists only when applications pass pre-parsed objects or untrusted data structures to the compilation functions. Security teams should audit their codebases to identify any instances where external data is fed directly into `Handlebars.compile()` or `Handlebars.precompile()`.

What to do and how to stay safe: Handlebars

  • Identify all instances of Handlebars in your project dependencies and verify the version number.
  • Upgrade to version 4.7.10 or later to apply the necessary security patches.
  • Review application code to ensure that untrusted data, such as JSON request bodies, is not passed directly to compilation functions.
  • Monitor security advisories for updates on related vulnerabilities in template engines.

Step-by-step guide: Automatic Updates Mistakes That Leave Systems Exposed

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

Frequently asked questions

Which versions of Handlebars are affected by this vulnerability?

Versions 4.0.0 through 4.7.9 are vulnerable. Version 4.7.10 contains the fix.

Does this vulnerability affect all Handlebars applications?

No, applications that only pass template strings to the compilation functions are not affected.

How can attackers exploit this flaw?

Attackers can inject arbitrary JavaScript by passing untrusted objects, such as parsed JSON, to the compile or precompile functions.

Sources

  1. GitHub Advisory Database
HandlebarsCVE-2026-106446npmremote code executiontemplate engine

Related stories