GHSA-g9r4-xpmj-mj65: Handlebars Prototype Pollution Vulnerability
HIGHGHSA-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
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.
npm install handlebars@3.0.8
npm install handlebars@4.5.3
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
GHSA-g9r4-xpmj-mj65 Affected Handlebars Versions
2 component(s)| 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?
Which Handlebars versions are affected?
What version fixes GHSA-g9r4-xpmj-mj65?
Is handlebars affected?
What CWE is associated with GHSA-g9r4-xpmj-mj65?
How can I check npm dependencies for GHSA-g9r4-xpmj-mj65?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}