{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2022-31180","id":"CVE-2022-31180","title":"Insufficient escaping of whitespace in shescape","description":"Shescape is a simple shell escape package for JavaScript. Affected versions were found to have insufficient escaping of white space when interpolating output. This issue only impacts users that use the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. The result is that if an attacker is able to include whitespace in their input they can: 1. Invoke shell-specific beh","descriptionLong":"Shescape is a simple shell escape package for JavaScript. Affected versions were found to have insufficient escaping of white space when interpolating output. This issue only impacts users that use the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. The result is that if an attacker is able to include whitespace in their input they can: 1. Invoke shell-specific behaviour through shell-specific special characters inserted directly after whitespace. 2. Invoke shell-specific behaviour through shell-specific special characters inserted or appearing after line terminating characters. 3. Invoke arbitrary commands by inserting a line feed character. 4. Invoke arbitrary commands by inserting a carriage return character. Behaviour number 1 has been patched in [v1.5.7] which you can upgrade to now. No further changes are required. Behaviour number 2, 3, and 4 have been patched in [v1.5.8] which you can upgrade to now. No further changes are required. The best workaround is to avoid having to use the `interpolation: true` option - in most cases using an alternative is possible, see [the recipes](https://github.com/ericcornelissen/shescape#recipes) for recommendations. Alternatively, users may strip all whitespace from user input. Note that this is error prone, for example: for PowerShell this requires stripping `'\\u0085'` which is not included in JavaScript's definition of `\\s` for Regular Expressions.","published":"2022-08-01T19:15:16.000Z","updated":"2026-10-28T02:30:49.001546214Z","reserved":"2022-05-18T00:00:00.000Z","status":"Modified","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"GitHub_M"},"metrics":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"GitHub_M"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"github.com"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"NVD"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"OSV"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"GitHub"}],"rating":"critical","products":["ericcornelissen shescape"],"affectedProducts":[{"vendor":"ericcornelissen","product":"shescape","defaultStatus":null,"versions":[{"status":"affected","version":">=1.4.0 < 1.5.8"}],"platforms":[]}],"packages":[{"ecosystem":"npm","name":"shescape","purl":"pkg:npm/shescape","ranges":[">=1.4.0 <1.5.8"],"fixed":["1.5.8"],"advisory":"GHSA-44vr-rwwj-p88h"}],"cwes":["CWE-74"],"aliases":["GHSA-44vr-rwwj-p88h"],"references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h","tags":["x_refsource_CONFIRM","x_transferred","Exploit","Third Party Advisory","advisory","web"]},{"url":"https://github.com/ericcornelissen/shescape/pull/322","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web"]},{"url":"https://github.com/ericcornelissen/shescape/pull/324","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7","tags":["x_refsource_MISC","x_transferred","Release Notes","Third Party Advisory","web"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8","tags":["x_refsource_MISC","x_transferred","Release Notes","Third Party Advisory","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31180.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31180","tags":["advisory"]},{"url":"https://github.com/ericcornelissen/shescape/pull/332","tags":["web"]},{"url":"https://github.com/ericcornelissen/shescape","tags":["package"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":true,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"total"},"epss":0.01993,"epssPercentile":0.81115,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2022-31180","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31180","ok":true,"note":"Modified"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2022-31180","ok":true,"note":"1 package"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-44vr-rwwj-p88h","ok":true,"note":"GHSA-44vr-rwwj-p88h"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2022-31180","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}