GHSA-g9r4-xpmj-mj65: Handlebars Prototype Pollution Vulnerability

HIGH
CWE-1321
Published
Advisory Summary

GHSA-g9r4-xpmj-mj65 is a HIGH prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Handlebars libraries in the npm ecosystem. The issue involves prototype pollution in handlebars. Remediation is available by upgrading affected packages to version 3.0.8, 4.5.3.

GHSA-g9r4-xpmj-mj65 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-g9r4-xpmj-mj65
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Handlebars
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-g9r4-xpmj-mj65

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: 3.0.8
npm install handlebars@3.0.8
handlebars fixed: 4.5.3
npm install handlebars@4.5.3
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-g9r4-xpmj-mj65, 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 3.0.8), 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. 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 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions. ## Recommendation Upgrade to version 3.0.8, 4.5.3 or later.

GHSA-g9r4-xpmj-mj65 Affected Handlebars Versions

2 component(s)
Fixed Versions:
3.0.84.5.3
Product / Package Ecosystem Affected Versions Fixed Version
handlebars
npm
< 3.0.8
3.0.8
handlebars
npm
≥ 4.0.0
< 4.5.3
4.5.3

References

Frequently Asked Questions

What is GHSA-g9r4-xpmj-mj65?
GHSA-g9r4-xpmj-mj65 is a security vulnerability in Handlebars involving Prototype Pollution in handlebars under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Handlebars versions are affected?
Affected versions include releases prior to 3.0.8, 4.5.3 across affected packages: handlebars.
What version fixes GHSA-g9r4-xpmj-mj65?
Upgrading to 3.0.8, 4.5.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is handlebars affected?
Yes, handlebars is affected in releases prior to 3.0.8, 4.5.3. Upgrade your dependency to 3.0.8, 4.5.3 or later.
What CWE is associated with GHSA-g9r4-xpmj-mj65?
GHSA-g9r4-xpmj-mj65 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for GHSA-g9r4-xpmj-mj65?
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-g9r4-xpmj-mj65",
  "modified" : "2020-08-31T18:55:14Z",
  "published" : "2020-09-04T15:06:32Z",
  "aliases" : [ ],
  "summary" : "Prototype Pollution in handlebars",
  "details" : "Versions of `handlebars` prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. It is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.\n\n\n## Recommendation\n\nUpgrade to version 3.0.8, 4.5.3 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "handlebars"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.5.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1325"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:55:14Z",
    "nvd_published_at" : null
  }
}