Miggo Logo

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

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.91368%
Published
5/24/2022
Updated
2/2/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
shell-quotenpm<= 1.7.21.7.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the regex pattern in the quote function located in index.js. The commit diff shows the critical fix was changing [A-z] to [A-Za-z] in the drive letter regex. This incorrect character class allowed injection via characters like backticks. The function's purpose (shell argument quoting) and the added test case explicitly testing this scenario confirm its role in the vulnerability.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

T** s**ll-quot* p**k*** ***or* *.*.* *or No**.js *llows *omm*n* inj**tion. *n *tt**k*r **n inj**t un*s**p** s**ll m*t****r**t*rs t*rou** * r***x **si*n** to support Win*ows *riv* l*tt*rs. I* t** output o* t*is p**k*** is p*ss** to * r**l s**ll *s * q

Reasoning

T** vuln*r**ility st*ms *rom t** r***x p*tt*rn in t** `quot*` *un*tion lo**t** in `in**x.js`. T** *ommit *i** s*ows t** *riti**l *ix w*s ***n*in* [*-z] to [*-Z*-z] in t** *riv* l*tt*r r***x. T*is in*orr**t ***r**t*r *l*ss *llow** inj**tion vi* ***r**