CVE-2021-42740
9.8 CRITICALThe shell-quote package before 1.7.3 for Node.js allows command injection
Published: 2021-10-21 · Last updated: 2026-06-17
Severity and scoring
- CVSS
- 9.8 CRITICAL
- Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CWE
- CWE-77
Affected products
| Vendor | Product |
|---|---|
| shell-quote_project | shell-quote |
Description
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.
Source: NVD
References
- [NVD]https://nvd.nist.gov/vuln/detail/CVE-2021-42740
- [Other]https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md#173
- [Patch]https://github.com/substack/node-shell-quote/commit/5799416ed454aa4ec9afafc895b4e31760ea1abe
- [Vendor advisory]https://www.npmjs.com/package/shell-quote
- [Other]https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md#173
- [Patch]https://github.com/substack/node-shell-quote/commit/5799416ed454aa4ec9afafc895b4e31760ea1abe
- [Vendor advisory]https://www.npmjs.com/package/shell-quote
Related CVEs
Same CWE
- CVE-2024-24909 — Dell OpenManage Integration with Microsoft Windows Admin Center contains a Remote Code Execution vulnerability in the gateway plugin (8.8 HIGH)
- CVE-2025-56814 — A code injection vulnerability in the wxExecute() function of OpenCPN v5.12.0 allows attackers to execute arbitrary code via embedding sh... (7.8 HIGH)
- CVE-2026-12223 — A vulnerability was identified in Yealink SIP-T46U 108.86.0.118 (5.5 MEDIUM)
- CVE-2026-12219 — A flaw has been found in Yealink SIP-T46U 108.86.0.118 (6.3 MEDIUM)
- CVE-2026-12197 — A security flaw has been discovered in Ruijie EG105G-P 2.340 (7.2 HIGH)