CVE-2023-40185: Shescape on Windows escaping may be bypassed in threaded context
8.6
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.25082%
CWE
Published
8/22/2023
Updated
11/9/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| shescape | npm | < 1.7.4 | 1.7.4 |
Vulnerability Intelligence
Miggo AI
Root 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.