Skip to content

CVE-2021-42740 Improper Neutralization of Special Elements used in a Command in Shell-quote

CriticalCVSS 9.8 EPSS 4.1%
Published
Updated
Exploit status
No public exploit known
Technology
UbuntuDebian

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.

Upgrade path

6 packages: 5 fixed, 1 with no fix yet.

PackageAffectedFixed inStatus
ubuntu/node-shell-quote(Ubuntu Pro 18.04) = 1.6.1+20160617-git72fb5a8ce29b-1; = 1.6.1+20160617-git72fb5a8ce29b-1ubuntu0.1~esm1; All versions No fix listed No fix yet
debian/node-shell-quote(Debian 12) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1 Fixed
debian/node-shell-quote(Debian 13) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1 Fixed
debian/node-shell-quote(Debian 14) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1 Fixed
npm shell-quote(npm) >= 1.6.3, < 1.7.3; >= 1.6.3, <= 1.7.2 1.7.3 Fixed
shell-quote project shell-quote < 1.7.3 1.7.3 Fixed

Affected products

ProductAffected versionsFixed in
debian/node-shell-quote(Debian:12) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1
debian/node-shell-quote(Debian:13) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1
debian/node-shell-quote(Debian:14) < 1.7.3+~1.7.1-1 1.7.3+~1.7.1-1
npm shell-quote(npm) >= 1.6.3, <= 1.7.2 No fix listed
shell-quote project shell-quote < 1.7.3 1.7.3
npm shell-quote(npm) >= 1.6.3, < 1.7.3 1.7.3
ubuntu/node-shell-quote(Ubuntu:Pro:18.04) All versions No fix listed
ubuntu/node-shell-quote(Ubuntu:Pro:18.04) = 1.6.1+20160617-git72fb5a8ce29b-1 No fix listed
ubuntu/node-shell-quote(Ubuntu:Pro:18.04) = 1.6.1+20160617-git72fb5a8ce29b-1ubuntu0.1~esm1 No fix listed

References