{"id":"CVE-2023-35931","aliases":["CVE-2023-35931","GHSA-3g7p-8qhx-mc8r"],"related":[],"kind":"vulnerability","state":"published","title":"Shescape potential environment variable exposure on Windows with CMD","summary":"Shescape is a simple shell escape library for JavaScript. An attacker may be able to get read-only access to environment variables. This bug has been patched in version 1.7.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Shescape is a simple shell escape library for JavaScript. An attacker may be able to get read-only access to environment variables. This bug has been patched in version 1.7.1.","source":"cvelist"},{"lang":"en","text":"### 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)","format":"markdown","source":"ghsa"}],"published":"2023-06-22T20:01:39.000Z","modified":"2026-09-10T03:50:01.856Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-526"],"affected":[{"ranges":[{"version":"< 1.7.1","status":"affected"}],"vendor":"ericcornelissen","product":"shescape","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.7.1"}],"ecosystem":"npm","package":"shescape","purl":"pkg:npm/shescape","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.7.1"}],"vendor":"shescape_project","product":"shescape","cpe":"cpe:2.3:a:shescape_project:shescape:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-3g7p-8qhx-mc8r","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/pull/982","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/commit/d0fce70f987ac0d8331f93cb45d47e79436173ac","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.7.1","tags":["release-notes","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-35931","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ericcornelissen/shescape","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-12-05T16:08:36.951Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-35931","url":"https://www.cve.org/CVERecord?id=CVE-2023-35931","licence":"CVE Terms of Use","modified":"2024-12-05T16:09:33.483Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3g7p-8qhx-mc8r","url":"https://github.com/advisories/GHSA-3g7p-8qhx-mc8r","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:01.856Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-35931","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-35931","licence":"Public domain","modified":"2026-06-17T06:05:29.517Z"}],"updatedAt":"2026-11-25T22:58:25.197Z","epss":{"score":0.0074,"percentile":0.507,"date":"2026-11-30T12:00:22.000Z"}}