Skip to main content
Vulnerability Database/CVE-2026-106445

CVE-2026-106445: Handlebars Template Engine RCE Vulnerability

CVE-2026-106445 is a remote code execution flaw in Handlebars template engine that allows attackers to execute arbitrary JavaScript code. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-106445 Overview

CVE-2026-106445 is a prototype-access bypass in Handlebars.js affecting versions 4.0.0 through 4.7.9. The lookupProperty function returns Function.prototype.constructor before applying the prototype-access deny list, because constructor exists as an own property of Function.prototype. Attackers who can render a controlled template with allowProtoMethodsByDefault enabled and an accessible function in the template context can walk from that function to its prototype, then obtain the Function constructor through the own-property bypass. The result is arbitrary JavaScript execution with the privileges of the server application. The issue is fixed in Handlebars 4.7.10.

Critical Impact

Remote code execution in Node.js server applications that render untrusted Handlebars templates with permissive prototype access.

Affected Products

  • Handlebars.js versions 4.0.0 through 4.7.9
  • Node.js server applications rendering attacker-controlled Handlebars templates
  • Downstream frameworks and tools bundling vulnerable Handlebars releases

Discovery Timeline

  • 2026-10-06 - CVE-2026-106445 published to the National Vulnerability Database
  • 2026-10-07 - Last updated in NVD database

Technical Details for CVE-2026-106445

Vulnerability Analysis

Handlebars enforces a prototype-access deny list to prevent template logic from reaching dangerous built-ins such as Function and eval. The lookupProperty routine in lib/handlebars/internal/proto-access.js consults this deny list only after resolving the property on the parent object. Because constructor is defined as an own property of every function's prototype, the own-property fast path returns Function.prototype.constructor without ever consulting the deny list. This is a Restrictive Incorrect Comparison weakness tracked as [CWE-184].

When allowProtoMethodsByDefault is enabled and the template context exposes any function, an attacker can navigate someFn.prototype.constructor inside a Handlebars expression. That expression yields the Function constructor, which can be invoked to compile and execute arbitrary JavaScript inside the Node.js process.

Root Cause

The guard logic in proto-access.js fails to distinguish a benign own property from a prototype back-reference that re-exposes a sanitized global. Because Function.prototype.constructor === Function, resolving constructor as an own property re-grants access to a constructor the deny list is intended to block.

Attack Vector

Exploitation requires: a Handlebars runtime older than 4.7.10, the allowProtoMethodsByDefault option enabled on the compiled template, and a function reachable from the rendering context (helpers, model methods, or any contextual function reference). The attacker then submits a template that traverses from the function to its prototype and invokes the resulting Function constructor with an arbitrary code string, achieving code execution with the server's privileges over the network.

javascript
// Security patch in lib/handlebars/internal/proto-access.js
// Adds detection for prototype->constructor back-references so the
// deny-list check is no longer bypassed by "own" properties.

/**
 * Detect a prototype object's own "constructor" back-reference, e.g.
 * `Function.prototype.constructor === Function`. Because "constructor" is an
 * "own" property of such objects, it would otherwise bypass the prototype-access
 * checks and expose dangerous constructors (allowing arbitrary code execution).
 *
 * Only functions can be constructors, so other values are never treated as one
 * and their `prototype` is never read.
 */
export function isPrototypeConstructor(parent, propertyName, result) {
  return (
    propertyName === 'constructor' &&
    typeof result === 'function' &&
    parent === result.prototype
  );
}

function checkWhiteList(protoAccessControlForType, propertyName) {
  if (protoAccessControlForType.whitelist[propertyName] !== undefined) {
    return protoAccessControlForType.whitelist[propertyName] === true;
  // ...

Source: Handlebars.js commit ceec388

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-106445

Indicators of Compromise

  • Handlebars template inputs containing the token sequence prototype.constructor or constructor( from untrusted sources.
  • Unexpected child processes spawned by Node.js workers that render templates, such as shells or network tools.
  • Outbound network connections initiated from the template rendering process to unknown hosts.
  • Server logs showing template compilation errors or runtime exceptions originating in proto-access.js.

Detection Strategies

  • Inventory installed handlebars package versions across repositories and running services; flag any version below 4.7.10.
  • Perform static analysis of Node.js code for the allowProtoMethodsByDefault option and template contexts that expose functions.
  • Deploy runtime application monitoring to alert on child_process or vm module invocations triggered from template rendering code paths.

Monitoring Recommendations

  • Collect Node.js process telemetry and correlate template rendering events with process creation, DNS lookups, and file writes.
  • Enable Software Composition Analysis in CI pipelines to block builds that include Handlebars prior to 4.7.10.
  • Alert on web application firewall patterns targeting {{constructor.constructor( or prototype.constructor within HTTP request bodies.

How to Mitigate CVE-2026-106445

Immediate Actions Required

  • Upgrade Handlebars to version 4.7.10 or later in all package.json manifests and lockfiles.
  • Audit application code for use of allowProtoMethodsByDefault and disable it unless strictly required.
  • Review template contexts and remove or wrap functions that are not needed during rendering.
  • Rebuild and redeploy container images, serverless functions, and bundled artifacts that embed Handlebars.

Patch Information

The fix is included in Handlebars.js release v4.7.10 and is implemented in pull request 2185. The patch adds an isPrototypeConstructor check in lib/handlebars/internal/proto-access.js and lib/handlebars/runtime.js so the deny list is enforced even when constructor resolves as an own property. Full technical context is available in GitHub Security Advisory GHSA-p8wg-vrv2-v86f.

Workarounds

  • Keep allowProtoMethodsByDefault disabled, which is the default configuration.
  • Avoid passing user-controlled strings as Handlebars templates; compile only trusted templates.
  • Strip functions from template contexts and pass plain data objects where possible.
  • Deploy input validation at the edge to reject payloads containing constructor traversal patterns.
bash
# Upgrade Handlebars to the patched release
npm install handlebars@4.7.10 --save

# Verify the installed version across the dependency tree
npm ls handlebars

# Audit for known advisories including GHSA-p8wg-vrv2-v86f
npm audit --production

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.