Miggo Logo

CVE-2022-31179: Shescape prior to 1.5.8 vulnerable to insufficient escaping of line feeds for CMD

8.1

CVSS Score
3.1

Basic Information

EPSS Score
0.35309%
Published
7/15/2022
Updated
4/6/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
shescapenpm< 1.5.81.5.8

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from insufficient escaping of line feeds in cmd.exe arguments. The commit diff shows escapeArgCmd in src/win.js was modified to add .replace(/\n|\r/g, " "), indicating this was the missing defense. The CVE specifically impacts cmd.exe usage, and the patch explicitly addresses this function. Other functions (escape/quote APIs) are entry points but delegate to escapeArgCmd when using cmd.exe.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t T*is imp**ts us*rs t**t us* S**s**p* (*ny *PI *un*tion) to *s**p* *r*um*nts *or ***m*.*x*** on **Win*ows**. *n *tt**k*r **n omit *ll *r*um*nts *ollowin* t**ir input *y in*lu*in* * lin* **** ***r**t*r (`'\n'`) in t** p*ylo**. *x*mpl*: ```

Reasoning

T** vuln*r**ility st*ms *rom insu**i*i*nt *s**pin* o* lin* ****s in `*m*.*x*` *r*um*nts. T** *ommit *i** s*ows `*s**p**r**m*` in `sr*/win.js` w*s mo*i*i** to *** `.r*pl***(/\n|\r/*, " ")`, in*i**tin* t*is w*s t** missin* ****ns*. T** *V* sp**i*i**lly