Shescape potential environment variable exposure on Windows with CMD
Impact
This impact users of Shescape:
- On Windows using the Windows Command Prompt (i.e.
cmd.exe), and - Using
quote/quoteAllorescape/escapeAllwith theinterpolationoption set totrue.
An attacker may be able to get read-only access to environment variables. Example:
import * as cp from "node:child_process";
import * as shescape from "shescape";
// 1. Prerequisites
const options = {
shell: "cmd.exe",
// Or
shell: undefined, // Only if the default shell is CMD
// And
interpolation: true, // Only applies to `escape` and `escapeAll` usage
}
// 2. Attack (one of many)
const payload = "%PATH%";
// 3. Usage
let escapedPayload;
escapedPayload = shescape.quote(payload, options);
// Or
escapedPayload = shescape.quoteAll([payload], options);
// Or
escapedPayload = shescape.escape(payload, options);
// Or
escapedPayload = shescape.escapeAll([payload], options);
// And (example)
const result = cp.execSync(`echo Hello ${escapedPayload}`, options);
// 4. Impact
console.log(result.toString());
// Outputs "Hello" followed by the contents of the PATH environment variable
Patches
This bug has been patched in v1.7.1 which you can upgrade to now. No further changes are required.
Workarounds
Alternatively, users can remove all instances of % from user input, either before or after using Shescape.
References
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| npm-Paket | shescape | < 1.7.1 | 1.7.1 |
Verweise
- https://github.com/ericcornelissen/shescape/security/advisories/GHSA-3g7p-8qhx-mc8r
- https://nvd.nist.gov/vuln/detail/CVE-2023-35931
- https://github.com/ericcornelissen/shescape/pull/982
- https://github.com/ericcornelissen/shescape/commit/d0fce70f987ac0d8331f93cb45d47e79436173ac
- https://github.com/ericcornelissen/shescape
- https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1
- CVSS-Vektor
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N- Schwäche (CWE)
CWE-526- Plattform
- npm
- Paket
shescape- Veröffentlicht
- 22.06.2023
- Aktualisiert
- 11.10.2026 10:22
Quellen und Lizenzen
OSV / GitHub Advisory Database - GHSA-3g7p-8qhx-mc8r - CC BY 4.0
Schwachstellenhistorie: shescape
Alle veröffentlichten Schwachstellen dieses Pakets (npm-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 13
- Erste → letzte
- 03.2021 07.2026
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Kritisch 2
- Hoch 5
- Mittel 4
- Niedrig 2
Veröffentlichungen pro Jahr
- 2021: 1
- 2022: 4
- 2023: 2
- 2024: 0
- 2025: 1
- 2026: 5
-
Shescape potential environment variable exposure on Windows with CMD dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.