CVE-2021-42740 json
Improper Neutralization of Special Elements used in a Command in Shell-quote
published 2021-10-21 5 y ago modified 2026-09-10 1 mo ago also GHSA-g4rg-993r-mgx7 , EUVD-2022-3886
- cvss
- 9.8
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 4.2%
- EPSS 4.2% chance of exploitation in 30 days, percentile 91%
- public exploits
- 0
- none known
Summary
The shell-quote package before 1.7.3 for Node.js allows command injection. An attacker can inject unescaped shell metacharacters through a regex designed to support Windows drive letters. If the output of this package is passed to a real shell as a quoted argument to a command with exec(), an attacker can inject arbitrary commands. This is because the Windows drive letter regex character class is {A-z] instead of the correct {A-Za-z]. Several shell metacharacters exist in the space between capital letter Z and lower case letter a, such as the backtick character.
Patch / fix
- npm shell-quote 1.7.3
- shell-quote_project shell-quote 1.7.3
- node-shell-quote Debian 14, Debian 13, Debian 12 1.7.3+~1.7.1-1
debian advisories DEBIAN-CVE-2021-42740
- smdba Manager Server Module 4.2 1.7.11-0.150300.3.12.2
- drools Manager Server Module 4.2 7.17.0-150300.4.9.2
- rhnlib Manager Server Module 4.2, Manager Proxy Module 4.2 4.2.7-150300.4.12.2
- cobbler Manager Server Module 4.2 3.1.2-150300.5.19.1
- mgr-osad Manager Server Module 4.2, Manager Proxy Module 4.2 4.2.9-150300.2.12.2
- spacecmd Manager Server Module 4.2, Manager Proxy Module 4.2 4.2.21-150300.4.33.2
- woodstox Manager Server Module 4.2 4.4.2-150300.3.6.2
- susemanager Manager Server Module 4.2 4.2.40-150300.3.49.1
suse advisories SUSE-SU-2023:0592-1SUSE-SU-2022:3761-1SUSE-SU-2022:3314-1SUSE-SU-2022:3313-1
Exploit prediction
4.22% chance of exploitation in the next 30 days, higher than 91% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| NVD | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 2.0 | 7.5 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
| GitHub | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | shell-quote | >=1.6.3, <1.7.3 |
1.7.3 |
Classification
- Weakness
-
- CWE-77 Improper Neutralization of Special Elements used in a Command
References
-
github.com
/substack/node-shell-quote/commit/5799416ed454aa4ec9afafc895b4e31760ea1abe
patch, third-party-advisory
-
github.com
/ljharb/shell-quote/commit/5799416ed454aa4ec9afafc895b4e31760ea1abe
web
-
npmjs.com
/package/shell-quote
web, vendor-advisory
-
github.com
/substack/node-shell-quote/blob/master/CHANGELOG.md#173
third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-42740
advisory
-
github.com
/ljharb/shell-quote
package
-
github.com
/ljharb/shell-quote/blob/master/CHANGELOG.md#173
web
Sources
- CVE List CVE-2021-42740
- GitHub Advisory GHSA-g4rg-993r-mgx7
- NVD CVE-2021-42740
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.