Vulnerabilities in pkg:maven/org.webjars.bowergithub.wycats/handlebars.js
PACKAGECVE-2021-23369 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Handlebars libraries in the npm ecosystem. The issue involves remote code execution in handlebars when compiling templates. Remediation is available by upgrading affected packages to version 4.7.7.
pkg:maven/org.webjars.bowergithub.wycats/handlebars.js
Vulnerability advisories affecting package pkg:maven/org.webjars.bowergithub.wycats/handlebars.js. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-f2jv-r9rf-7988 | CVE-2021-23369 | CRITICAL | Remote code execution in handlebars when compiling templates |
CVE-2021-23369 at a Glance
Security Impact
CVSS: 9.8
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:H/I:H/A:H).
How to Fix CVE-2021-23369
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@4.7.7
<dependency>
<groupId>org.webjars</groupId>
<artifactId>handlebars</artifactId>
<version>4.7.7</version>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>handlebars</artifactId>
<version>4.7.7</version>
</dependency>
<dependency>
<groupId>org.webjars.bowergithub.wycats</groupId>
<artifactId>handlebars.js</artifactId>
<version>4.7.7</version>
</dependency>
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-2021-23369, 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.7), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. 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
CVE-2021-23369 Affected Handlebars Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
handlebars
|
npm |
< 4.7.7
|
4.7.7
|
|
org.webjars:handlebars
|
Maven |
< 4.7.7
|
4.7.7
|
|
org.webjars.npm:handlebars
|
Maven |
< 4.7.7
|
4.7.7
|
|
org.webjars.bowergithub.wycats:handlebars.js
|
Maven |
< 4.7.7
|
4.7.7
|
References
Frequently Asked Questions
What is CVE-2021-23369?
Which Handlebars versions are affected?
What version fixes CVE-2021-23369?
Is handlebars affected?
Is handlebars.js affected?
What is the CVSS score of CVE-2021-23369?
What CWE is associated with CVE-2021-23369?
How can I check npm dependencies for CVE-2021-23369?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f2jv-r9rf-7988",
"modified" : "2022-10-04T16:29:30Z",
"published" : "2021-05-06T15:57:44Z",
"aliases" : [ "CVE-2021-23369" ],
"summary" : "Remote code execution in handlebars when compiling templates",
"details" : "The package handlebars before 4.7.7 are vulnerable to Remote Code Execution (RCE) when selecting certain compiling options to compile templates coming from an untrusted source.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "handlebars"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.7.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.webjars:handlebars"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.7.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.webjars.npm:handlebars"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.7.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.webjars.bowergithub.wycats:handlebars.js"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.7.7"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23369"
}, {
"type" : "WEB",
"url" : "https://github.com/handlebars-lang/handlebars.js/commit/b6d3de7123eebba603e321f04afdbae608e8fea8"
}, {
"type" : "WEB",
"url" : "https://github.com/handlebars-lang/handlebars.js/commit/f0589701698268578199be25285b2ebea1c1e427"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/wycats/handlebars.js"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20210604-0008"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1074950"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-1074951"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1074952"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-HANDLEBARS-1056767"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-13T22:07:10Z",
"nvd_published_at" : "2021-04-12T14:15:00Z"
}
}