Miggo Logo

CVE-2023-35931: Shescape potential environment variable exposure on Windows with CMD

3.1

CVSS Score
3.1

Basic Information

EPSS Score
0.48919%
Published
6/22/2023
Updated
11/7/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from inadequate escaping of '%' characters in Windows CMD handling. The commit diff shows both functions in src/win/cmd.js were modified to add '%' escaping:

  1. escapeArgForInterpolation's regex was expanded to include '%' in the character set
  2. escapeArgForQuoted explicitly added a '%' replacement. These functions are directly responsible for argument sanitization when using quote/escape methods with CMD, and their pre-patch behavior allowed environment variable expansion through unescaped '%' characters.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t T*is imp**t us*rs o* S**s**p*: *. On Win*ows usin* t** Win*ows *omm*n* Prompt (i.*. `*m*.*x*`), *n* *. Usin* `quot*`/`quot**ll` or `*s**p*`/`*s**p**ll` wit* t** `int*rpol*tion` option s*t to `tru*`. *n *tt**k*r m*y ** **l* to **t r***-o

Reasoning

T** vuln*r**ility st*ms *rom in***qu*t* *s**pin* o* '%' ***r**t*rs in Win*ows *M* **n*lin*. T** *ommit *i** s*ows *ot* *un*tions in sr*/win/*m*.js w*r* mo*i*i** to *** '%' *s**pin*: *. *s**p**r**orInt*rpol*tion's r***x w*s *xp*n*** to in*lu** '%' in