CVE-2021-42740: Improper Neutralization of Special Elements used in a Command in Shell-quote
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.91368%
CWE
Published
5/24/2022
Updated
2/2/2024
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| shell-quote | npm | <= 1.7.2 | 1.7.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the regex pattern in the quote function located in index.js. The commit diff shows the critical fix was changing [A-z] to [A-Za-z] in the drive letter regex. This incorrect character class allowed injection via characters like backticks. The function's purpose (shell argument quoting) and the added test case explicitly testing this scenario confirm its role in the vulnerability.