# CVE-2025-30222: Shescape has potential environment variable exposure on Windows with CMD


- **Severity:** Low 2.1 (`CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:U`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 25 Mar 2025
- **Updated:** 26 Mar 2025
- **Also known as:** GHSA-66pp-5p9w-q87j

## What is CVE-2025-30222?

CVE-2025-30222 is a low-severity vulnerability in ericcornelissen shescape, published on 25 Mar 2025. 

### Official description

Shescape is a simple shell escape library for JavaScript. Versions 1.7.2 through 2.1.1 are vulnerable to potential environment variable exposure on Windows with CMD. This impact users of Shescape on Windows that explicitly configure `shell: 'cmd.exe'` or `shell: true` using any of `quote`/`quoteAll`/`escape`/`escapeAll`. An attacker may be able to get read-only access to environment variables. This bug has been patched in v2.1.2. For those who are already using v2 of Shescape, no further changes are required. Those who are are using v1 of Shescape should follow the migration guide to upgrade to v2. There is no plan to release a patch compatible with v1 of Shescape. As a workaround, users can remove all instances of `%` from user input before using Shescape.

Weakness: CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2025-30222?

2 open source packages ship an affected version, including shescape.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `shescape` | npm | From 1.7.2 | 2.1.2 |
| `shescape` | npm | From 1.7.2 | 2.1.2 |

## How do I fix CVE-2025-30222?

Upgrade shescape to 2.1.2 or later.

## Is CVE-2025-30222 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-30222 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-30222 and fix it if it is affected.

What it is: CVE-2025-30222 is a low-severity vulnerability in ericcornelissen shescape, published on 25 Mar 2025. 
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-30222 exists.

Affected packages and fixed versions:
- shescape (npm): affected from 1.7.2; fixed in 2.1.2
- shescape (npm): affected from 1.7.2; fixed in 2.1.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-30222/ (Markdown: https://insights.sbomify.com/CVE-2025-30222/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-30222
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-30222
- OSV: https://osv.dev/vulnerability/CVE-2025-30222

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-30222/
Summaries are generated and may contain mistakes; the official description above is the record.
