{"id":"GHSA-3g7p-8qhx-mc8r","revision":"65bf5a944964473d9d7834fd4a5be7cf","records":[{"revision":"65bf5a944964473d9d7834fd4a5be7cf","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-3g7p-8qhx-mc8r","aliases":["CVE-2023-35931"],"title":"Shescape potential environment variable exposure on Windows with CMD","description":"### Impact\n\nThis impact users of Shescape:\n\n1. On Windows using the Windows Command Prompt (i.e. `cmd.exe`), and\n2. Using `quote`/`quoteAll` or `escape`/`escapeAll` with the `interpolation` option set to `true`.\n\nAn attacker may be able to get read-only access to environment variables. Example:\n\n```javascript\nimport * as cp from \"node:child_process\";\nimport * as shescape from \"shescape\";\n\n// 1. Prerequisites\nconst options = {\n    shell: \"cmd.exe\",\n    // Or\n    shell: undefined, // Only if the default shell is CMD\n\n    // And\n    interpolation: true, // Only applies to `escape` and `escapeAll` usage\n}\n\n// 2. Attack (one of many)\nconst payload = \"%PATH%\";\n\n// 3. Usage\nlet escapedPayload;\n\nescapedPayload = shescape.quote(payload, options);\n// Or\nescapedPayload = shescape.quoteAll([payload], options);\n// Or\nescapedPayload = shescape.escape(payload, options);\n// Or\nescapedPayload = shescape.escapeAll([payload], options);\n\n// And (example)\nconst result = cp.execSync(`echo Hello ${escapedPayload}`, options);\n\n// 4. Impact\nconsole.log(result.toString());\n// Outputs \"Hello\" followed by the contents of the PATH environment variable\n```\n\n### Patches\n\nThis bug has been patched in [v1.7.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1) which you can upgrade to now. No further changes are required.\n\n### Workarounds\n\nAlternatively, users can remove all instances of `%` from user input, either before or after using Shescape.\n\n### References\n\n- Shescape Pull request [#982](https://github.com/ericcornelissen/shescape/pull/982)\n- Shescape commit [`d0fce70`](https://github.com/ericcornelissen/shescape/commit/d0fce70f987ac0d8331f93cb45d47e79436173ac)\n- Shescape Release [v1.7.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1)\n","state":0,"publishedAt":"2023-06-22T20:01:39+00:00","modifiedAt":"2026-09-10T03:50:01.8564883+00:00","affected":[{"ecosystem":"npm","name":"shescape","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"1.7.1"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"LOW"}],"references":["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"],"sourceUrl":"https://github.com/advisories/GHSA-3g7p-8qhx-mc8r","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-3g7p-8qhx-mc8r","identifiers":["GHSA-3g7p-8qhx-mc8r","CVE-2023-35931"]},"retained":false,"historicalAffected":[]}],"coverage":[]}