CVE-2021-42740: Command Injection

Published Oct 21, 2021
·
Updated

Node.js shell-quote module could allow a remote attacker to execute arbitrary commands on the system, caused by a flaw with windows drive letter regex. By sending a specially-crafted shell metacharacters, an attacker could exploit this vulnerability to execute arbitrary commands on the system.

Other sources

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

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 Software

3 affected componentsFixes available
npm/shell-quote<=1.7.2
1.7.3
Shell-quote Project Shell-quote Node.js<1.7.3
IBM Planning Analytics<=2.0

Event History

Oct 21, 2021
CVE Published
via MITRE·02:46 PM
Data Sourced
via MITRE·02:46 PM
Description
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
May 24, 2022
Advisory Published
via GitHub·07:18 PM

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2021-42740?

CVE-2021-42740 is classified as a high severity vulnerability due to its potential for remote code execution.

2

How do I fix CVE-2021-42740?

To fix CVE-2021-42740, update the shell-quote module to version 1.7.3 or later.

3

What systems are affected by CVE-2021-42740?

CVE-2021-42740 affects the shell-quote module for Node.js and versions up to 1.7.2.

4

Can CVE-2021-42740 be exploited remotely?

Yes, CVE-2021-42740 can be exploited by a remote attacker to execute arbitrary commands on the system.

5

What is the impact of CVE-2021-42740?

The impact of CVE-2021-42740 includes the potential for arbitrary command execution on affected systems.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203