CVE-2023-40185 Shescape on Windows escaping may be bypassed in threaded context
Attackers can bypass shell escaping in threaded Windows contexts, potentially leading to command injection if the wrong shell is used.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-40185?
CVE-2023-40185 is a medium-severity command injection vulnerability in ericcornelissen shescape, published on 23 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
shescape is simple shell escape library for JavaScript. This may impact users that use Shescape on Windows in a threaded context. The vulnerability can result in Shescape escaping (or quoting) for the wrong shell, thus allowing attackers to bypass protections depending on the combination of expected and used shell. This bug has been patched in version 1.7.4.
Weakness: CWE-150
Which versions are affected by CVE-2023-40185?
2 open source packages ship an affected version, including shescape. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
shescape npm | All versions | 1.7.4 |
shescape npm | All versions | 1.7.4 |
Products include Shescape Project Shescape.
How do I fix CVE-2023-40185?
Upgrade shescape to 1.7.4 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2023-40185 being exploited?
There is no known exploitation of CVE-2023-40185 in the wild and no public exploit code.
Other vulnerabilities in ericcornelissen shescape
- CVE-2022-31180 Insufficient escaping of whitespace in shescape
- CVE-2022-31179 Insufficient escaping of line feeds for CMD in shescape
- CVE-2026-32094 Shescape escape() leaves bracket glob expansion active on Bash, BusyBox, and Dash
- CVE-2021-21384 Null characters not escaped in shescape
- CVE-2022-24725 Exposure of home directory through shescape on Unix with Bash
Sources
Also known as GHSA-j55r-787p-m549.