GHSA-q2c6-c6pm-g3gh: Handlebars Arbitrary Code Execution Vulnerability
HIGHGHSA-q2c6-c6pm-g3gh is a HIGH arbitrary code execution vulnerability (General Security Weakness) affecting Handlebars libraries in the npm ecosystem. The issue involves arbitrary code execution in handlebars. Remediation is available by upgrading affected packages to version 3.0.8, 4.5.3.
GHSA-q2c6-c6pm-g3gh at a Glance
How to Fix GHSA-q2c6-c6pm-g3gh
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-q2c6-c6pm-g3gh, 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 General Security Weakness. 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-q2c6-c6pm-g3gh 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-q2c6-c6pm-g3gh?
Which Handlebars versions are affected?
What version fixes GHSA-q2c6-c6pm-g3gh?
Is handlebars affected?
What CWE is associated with GHSA-q2c6-c6pm-g3gh?
How can I check npm dependencies for GHSA-q2c6-c6pm-g3gh?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q2c6-c6pm-g3gh",
"modified" : "2020-08-31T18:55:11Z",
"published" : "2020-09-04T15:07:38Z",
"aliases" : [ ],
"summary" : "Arbitrary Code Execution in handlebars",
"details" : "Versions of `handlebars` prior to 3.0.8 or 4.5.3 are vulnerable to Arbitrary Code Execution. The package's lookup helper fails to properly validate templates, allowing attackers to submit templates that execute arbitrary JavaScript in the system. It is due to an incomplete fix for a [previous issue](https://www.npmjs.com/advisories/1316). This vulnerability can be used to run arbitrary code in a server processing Handlebars templates or on a victim's browser (effectively serving as Cross-Site Scripting).\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/1324"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-08-31T18:55:11Z",
"nvd_published_at" : null
}
}