# CVE-2023-35931: ericcornelissen shescape environment variable exposure in CMD

Source: https://junglewise.ai/threats/cve-2023-35931-ericcornelissen-shescape-environment-variable-exposure-in-cmd  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2023-06-22. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

CVE-2023-35931 · Severity: low · CVSS 3.1 · Published 2023-06-22

Shescape is a JavaScript library used to safely escape user input for use in shell commands. A vulnerability in the library's Windows Command Prompt (CMD) handling allows an attacker to bypass security filters and read sensitive environment variables from the host system. This could lead to the exposure of system paths, configuration details, or other sensitive data stored in the environment.

Technologies: [shescape (npm)](https://junglewise.ai/threats/technologies/shescape). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2023-35931 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2023-35931 being exploited in the wild.

**How severe is CVE-2023-35931?** Low severity, with a CVSS score of 3.1, published 22 June 2023.

**Which products and versions are affected?** shescape (npm) SEMVER:introduced=0,fixed=1.7.1.

**Is there a fix for CVE-2023-35931?** Yes. shescape (npm): upgrade to 1.7.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2023-35931 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2023-35931?** Check whether you run shescape (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- shescape (npm): upgrade to 1.7.1 or later

  ```sh
  npm install shescape@1.7.1
  ```


## Technical details

Shescape fails to properly escape the percent sign (%) when used with the Windows Command Prompt (cmd.exe). When the 'interpolation' option is set to true in functions like quote, quoteAll, escape, or escapeAll, an attacker can provide a payload containing environment variable syntax (e.g., %PATH%). Because the library does not sanitize or escape these characters correctly for the CMD shell, the underlying system expands the variable, allowing the attacker to read its contents. This is classified as CWE-526 (Exposure of Sensitive Information Through Environmental Variables). The issue is fixed in version 1.7.1 by implementing proper percent-sign escaping.

## Affected products

- ericcornelissen shescape < 1.7.1

## Identifiers

- CVE-2023-35931
- GHSA-3g7p-8qhx-mc8r

## Timeline

- 2023-06-21: patched: Fix released in version 1.7.1
- 2023-06-22: disclosed: Security advisory published

## References

- [https://github.com/ericcornelissen/shescape/security/advisories/GHSA-3g7p-8qhx-mc8r](https://github.com/ericcornelissen/shescape/security/advisories/GHSA-3g7p-8qhx-mc8r)
- [https://github.com/ericcornelissen/shescape/pull/982](https://github.com/ericcornelissen/shescape/pull/982)
- [https://github.com/ericcornelissen/shescape/commit/d0fce70f987ac0d8331f93cb45d47e79436173ac](https://github.com/ericcornelissen/shescape/commit/d0fce70f987ac0d8331f93cb45d47e79436173ac)
- [https://github.com/ericcornelissen/shescape](https://github.com/ericcornelissen/shescape)
- [https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1)

## Related threats

- [Shescape shell injection via unescaped parentheses on Windows CMD](https://junglewise.ai/threats/cve-2026-73414-shescape-shell-injection-via-unescaped-parentheses-on-windows-cmd)
- [Shescape quadratic-time denial of service in flag-protection](https://junglewise.ai/threats/cve-2026-73413-shescape-quadratic-time-denial-of-service-in-flag-protection)
- [Shescape path disclosure on Unix with Zsh](https://junglewise.ai/threats/cve-2026-73412-shescape-path-disclosure-on-unix-with-zsh)
- [Shescape home-directory disclosure in Dash shell assignment](https://junglewise.ai/threats/cve-2026-73411-shescape-home-directory-disclosure-in-dash-shell-assignment)
- [Shescape escape() bracket glob expansion bypass on Bash, BusyBox, and Dash](https://junglewise.ai/threats/cve-2026-32094-shescape-escape-bracket-glob-expansion-bypass-on-bash-busybox-and)
