# CVE-2022-31180: Insufficient escaping of whitespace in shescape

- Severity: Critical 9.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.99%, higher than 81% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2022-07-15T21:46:08.000Z
- Modified: 2026-06-17T04:44:58.363Z
- Also known as: GHSA-44vr-rwwj-p88h
- Weaknesses: CWE-74
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total
- Assigned by: GitHub_M

## 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 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.

(As written by CVE List.)

## Affected

- ericcornelissen shescape: >=1.4.0 < 1.5.8
- shescape (npm): from 1.4.0 before 1.5.8
- shescape_project shescape: from 1.4.0 before 1.5.8

## Every score

- GitHub_M: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h> (exploit, third-party-advisory, web)
- <https://github.com/ericcornelissen/shescape/pull/322> (patch, third-party-advisory, web)
- <https://github.com/ericcornelissen/shescape/pull/324> (patch, third-party-advisory, web)
- <https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7> (release-notes, third-party-advisory, web)
- <https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8> (release-notes, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31180> (advisory)
- <https://github.com/ericcornelissen/shescape/pull/332> (web)
- <https://github.com/ericcornelissen/shescape> (package)

## Sources

- CVE List: [CVE-2022-31180](https://www.cve.org/CVERecord?id=CVE-2022-31180), CVE Terms of Use, modified 2025-04-22
- GitHub Advisory Database: [GHSA-44vr-rwwj-p88h](https://github.com/advisories/GHSA-44vr-rwwj-p88h), CC-BY-4.0, modified 2023-11-08
- NVD: [CVE-2022-31180](https://nvd.nist.gov/vuln/detail/CVE-2022-31180), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-31180 · Whole record: https://cve.day/CVE-2022-31180.json · Rebuilt by cve.day 2026-11-25T22:58:13.343Z
