9.8critical
Improper Neutralization of Special Elements used in a Command in Shell-quote
- Severity
- 9.8critical CVSS:3.1 by NVD
- Exploit likelihood
- 4.11% (higher than 91% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-g4rg-993r-mgx7
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| shell-quote (npm) | from 1.6.3 before 1.7.3 | GitHub Advisory Database |
| shell-quote_project shell-quote | before 1.7.3 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
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.
NVD (es)
El paquete shell-quote versiones anteriores a 1.7.3 para Node.js permite una inyección de comandos. Un atacante puede inyectar metacaracteres de shell sin esconder mediante una regex diseñada para soportar letras de unidad de Windows. Si la salida de este paquete se pasa a un shell real como un argumento citado a un comando con exec(), un atacante puede inyectar comandos arbitrarios. Esto es debido a que la clase de caracteres regex de la letra de unidad de Windows es {A-z] en lugar de la correcta {A-Za-z]. Se presentan varios metacaracteres del shell en el espacio entre la letra Z mayúscula y la letra a minúscula, como el carácter backtick
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-42740 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-g4rg-993r-mgx7 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2021-42740 changed 2026-06-17 | Public domain |