Miggo Logo

CVE-2023-40185: Shescape on Windows escaping may be bypassed in threaded context

8.6

CVSS Score
3.1

Basic Information

EPSS Score
0.25082%
Published
8/22/2023
Updated
11/9/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper environment variable handling in worker thread contexts on Windows. The key functions involved in shell detection and executable resolution (resolveExecutable, parseOptions, getShellName) lacked explicit environment variable passing prior to the fix. This caused Shescape to potentially use the wrong PATH environment variable value when resolving shell executables, particularly in threaded execution contexts where environment variable casing (PATH vs Path) and inheritance differ. The commit 0b976da explicitly passes environment variables through these functions to ensure correct shell detection regardless of execution context.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t T*is m*y imp**t us*rs t**t us* S**s**p* on Win*ows in * t*r***** *ont*xt (*.*. usin* [Work*r t*r***s](*ttps://no**js.or*/*pi/work*r_t*r***s.*tml)). T** vuln*r**ility **n r*sult in S**s**p* *s**pin* (or quotin*) *or t** wron* s**ll, t*us *

Reasoning

T** vuln*r**ility st*ms *rom improp*r *nvironm*nt v*ri**l* **n*lin* in work*r t*r*** *ont*xts on Win*ows. T** k*y *un*tions involv** in s**ll **t**tion *n* *x**ut**l* r*solution (r*solv**x**ut**l*, p*rs*Options, **tS**llN*m*) l**k** *xpli*it *nvironm