{"id":"CVE-2022-31179","published":"2022-08-01T19:20:18Z","modified":"2025-04-22T17:46:08Z","title":"Insufficient escaping of line feeds for CMD in shescape","vendor":"ericcornelissen","product":"shescape","tier":"tail","description":{"text":"Shescape is a simple shell escape package for JavaScript. Versions prior to 1.5.8 were found to be subject to code injection on windows. This impacts users that use Shescape (any API function) to escape arguments for cmd.exe on Windows An attacker can omit all arguments following their input by including a line feed character (`'\\n'`) in the payload. This bug has been patched in [v1.5.8] which you can upgrade to now. No further changes are required. Alternatively, line feed characters (`'\\n'`) can be stripped out manually or the user input can be made the last argument (this only limits the impact).","provenance":"source","from":"CVE.org"},"cvss":{"score":8.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01424,"percentile":0.73554,"provenance":"source"},"cwes":[{"id":"CWE-74","name":"Improper Neutralization of Special Elements in Output Used by a Downstream Component"}],"references":[{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8","tags":["x_refsource_MISC"]},{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-jjc5-fp7p-6f8w","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/ericcornelissen/shescape/pull/332","tags":["x_refsource_MISC"]}],"priority":{"score":20.4,"factors":[{"name":"EPSS percentile","points":14.71},{"name":"CVSS severity","points":5.67}]},"vendorSlug":"ericcornelissen","affectedVersions":[{"vendor":"ericcornelissen","product":"shescape","versions":["< 1.5.8"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2025-04-22T15:45:15.980233Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"shescape","vulnerableRanges":["<1.5.8"],"patched":["1.5.8"],"from":["GHSA-jjc5-fp7p-6f8w"],"provenance":"source"}],"summary":{"text":"The shescape package for JavaScript, a shell escaping library by ericcornelissen, fails to properly escape line feed characters when its API functions escape arguments for cmd.exe on Windows, leading to an injection flaw. An attacker who can supply input that is passed through shescape to cmd.exe can include a line feed character in the payload to cause all following arguments to be omitted, with the attack requiring network access and no privileges or user interaction, and the attack complexity is high.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:14:23Z"},"euvd":{"id":"EUVD-2022-6363","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-ericcornelissen-shescape-cve-2021-21384","parents":[{"from":"CVE-2021-21384","to":"CVE-2022-31179","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/unix.js","src/win.js"],"commits":["https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b","https://github.com/ericcornelissen/shescape/commit/aceea7358f7222984e21260381ebc5ec4543b76f"],"basis":"rarely changed file"}]}],"children":[{"from":"CVE-2022-31179","to":"CVE-2022-25918","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/unix.js"],"commits":["https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9","https://github.com/ericcornelissen/shescape/commit/aceea7358f7222984e21260381ebc5ec4543b76f"],"basis":"shared function","functions":["escapeArgBash"]}]}],"packageHistory":[{"cve":"CVE-2021-21384","published":"2021-03-18","fixed":"1.1.3","kev":false},{"cve":"CVE-2022-24725","published":"2022-03-03","fixed":"1.5.1","kev":false,"link":{"from":"CVE-2022-24725","to":"CVE-2022-31179","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"npm:shescape","fromFixed":"1.5.1","toFixed":"1.5.8","daysApart":151}]}},{"cve":"CVE-2022-31179","published":"2022-08-01","fixed":"1.5.8","kev":false},{"cve":"CVE-2022-31180","published":"2022-08-01","fixed":"1.5.8","kev":false},{"cve":"CVE-2022-25918","published":"2022-10-27","fixed":"1.6.1","kev":false},{"cve":"CVE-2023-35931","published":"2023-06-23","fixed":"1.7.1","kev":false}],"package":"npm:shescape"}}