CVE-2021-42740
JSON

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 packageVersionsReported by
Unspecified productn/aCVE List
shell-quote (npm)from 1.6.3 before 1.7.3GitHub Advisory Database
shell-quote_project shell-quotebefore 1.7.3NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV: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

SourceRecordLicence
CVE ListCVE-2021-42740 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-g4rg-993r-mgx7 changed 2026-09-10CC-BY-4.0
NVDCVE-2021-42740 changed 2026-06-17Public domain