GHSA-q42p-pg8m-cqh6: Handlebars Prototype Pollution Vulnerability

HIGH
CVSS 7.3
CWE-471
Published
Advisory Summary

GHSA-q42p-pg8m-cqh6 is a HIGH (CVSS 7.3) prototype pollution vulnerability (CWE-471: Modification of Assumed-Immutable Data (MAID)) affecting Handlebars libraries in the npm ecosystem. The issue involves prototype pollution in handlebars. Remediation is available by upgrading affected packages to version 4.1.2, 4.0.14, 3.0.7.

GHSA-q42p-pg8m-cqh6 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-q42p-pg8m-cqh6
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-471: Modification of Assumed-Immutable Data (MAID)
Affected Product Handlebars
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix GHSA-q42p-pg8m-cqh6

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.1.2
npm install handlebars@4.1.2
handlebars fixed: 4.0.14
npm install handlebars@4.0.14
handlebars fixed: 3.0.7
npm install handlebars@3.0.7
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 GHSA-q42p-pg8m-cqh6, 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.1.2), 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-471: Modification of Assumed-Immutable Data (MAID), where the product does not properly protect an assumed-immutable element from being modified by an attacker. 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

Versions of `handlebars` prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server. ## Recommendation For handlebars 4.1.x upgrade to 4.1.2 or later. For handlebars 4.0.x upgrade to 4.0.14 or later.

GHSA-q42p-pg8m-cqh6 Affected Handlebars Versions

3 component(s)
Fixed Versions:
4.1.24.0.143.0.7
Product / Package Ecosystem Affected Versions Fixed Version
handlebars
npm
≥ 4.1.0
< 4.1.2
4.1.2
handlebars
npm
≥ 4.0.0
< 4.0.14
4.0.14
handlebars
npm
< 3.0.7
3.0.7

References

Frequently Asked Questions

What is GHSA-q42p-pg8m-cqh6?
GHSA-q42p-pg8m-cqh6 is a security vulnerability in Handlebars involving Prototype Pollution in handlebars under CWE-471: Modification of Assumed-Immutable Data (MAID).
Which Handlebars versions are affected?
Affected versions include releases prior to 4.1.2, 4.0.14, 3.0.7 across affected packages: handlebars.
What version fixes GHSA-q42p-pg8m-cqh6?
Upgrading to 4.1.2, 4.0.14, 3.0.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is handlebars affected?
Yes, handlebars is affected in releases prior to 4.1.2, 4.0.14, 3.0.7. Upgrade your dependency to 4.1.2, 4.0.14, 3.0.7 or later.
What is the CVSS score of GHSA-q42p-pg8m-cqh6?
GHSA-q42p-pg8m-cqh6 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with GHSA-q42p-pg8m-cqh6?
GHSA-q42p-pg8m-cqh6 is classified under CWE-471: Modification of Assumed-Immutable Data (MAID) (The product does not properly protect an assumed-immutable element from being modified by an attacker.).
How can I check npm dependencies for GHSA-q42p-pg8m-cqh6?
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-q42p-pg8m-cqh6",
  "modified" : "2021-08-04T20:54:05Z",
  "published" : "2019-06-05T14:07:48Z",
  "aliases" : [ ],
  "summary" : "Prototype Pollution in handlebars",
  "details" : "Versions of `handlebars` prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.\n\n\n## Recommendation\n\nFor handlebars 4.1.x upgrade to 4.1.2 or later.\nFor handlebars 4.0.x upgrade to 4.0.14 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.1.0"
      }, {
        "fixed" : "4.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.14"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/issues/1495"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/commit/0d6d8c335ad81bad1b672fc56b6a44f6aa472dac"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/commit/7372d4e9dffc9d70c09671aa28b9392a1577fd86"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/commit/85c8783b34fc6d36145d8b53885ad0b9e3c3f9c4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/handlebars-lang/handlebars.js/commit/cd38583216dce3252831916323202749431c773e"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-HANDLEBARS-173692"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/755"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-471" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-06-05T13:55:39Z",
    "nvd_published_at" : null
  }
}