# CVE-2022-25918: shescape inefficient regex complexity

Source: https://junglewise.ai/threats/cve-2022-25918-shescape-inefficient-regex-complexity  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-10-25. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2022-25918 · Severity: low · CVSS 3.1 · Published 2022-10-25

Shescape is a Node.js library used to safely escape shell arguments for Unix shells like Bash. When the interpolation option is enabled, a vulnerable regular expression can be exploited to cause a denial-of-service attack by consuming excessive CPU resources through polynomial backtracking, making the application unresponsive or slow.

Technologies: [shescape (npm)](https://junglewise.ai/threats/technologies/shescape). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2022-25918 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2022-25918 being exploited in the wild.

**How severe is CVE-2022-25918?** Low severity, with a CVSS score of 3.1, published 25 October 2022.

**Which products and versions are affected?** shescape (npm) SEMVER:introduced=1.5.10,fixed=1.6.1.

**Is there a fix for CVE-2022-25918?** Yes. shescape (npm): upgrade to 1.6.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2022-25918 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2022-25918?** Check whether you run shescape (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- shescape (npm): upgrade to 1.6.1 or later

  ```sh
  npm install shescape@1.6.1
  ```


## Technical details

A Regular Expression Denial of Service (ReDoS) vulnerability exists in shescape versions 1.5.10 through 1.6.0 in the escape() and escapeAll() functions when the interpolation option is set to true for Bash or unsupported Unix shells. An attacker can supply crafted input (e.g., repeated "{," sequences) that causes polynomial backtracking in the regex engine, leading to excessive CPU consumption. The vulnerability requires network/application-level access to shescape with interpolation enabled, and no authentication is required. This can cause application-level denial of service or severe performance degradation. The vulnerability has been patched in version 1.6.1.

## Affected products

- ericcornelissen shescape >=1.5.10, <1.6.1

## Identifiers

- CVE-2022-25918
- GHSA-cr84-xvw4-qx3c

## Timeline

- 2022-10-25: disclosed
- 2022-10-25: patched: v1.6.1 released

## References

- [https://github.com/ericcornelissen/shescape/security/advisories/GHSA-cr84-xvw4-qx3c](https://github.com/ericcornelissen/shescape/security/advisories/GHSA-cr84-xvw4-qx3c)

## Related threats

- [Shescape shell injection via unescaped parentheses on Windows CMD](https://junglewise.ai/threats/cve-2026-73414-shescape-shell-injection-via-unescaped-parentheses-on-windows-cmd)
- [Shescape quadratic-time denial of service in flag-protection](https://junglewise.ai/threats/cve-2026-73413-shescape-quadratic-time-denial-of-service-in-flag-protection)
- [Shescape path disclosure on Unix with Zsh](https://junglewise.ai/threats/cve-2026-73412-shescape-path-disclosure-on-unix-with-zsh)
- [Shescape home-directory disclosure in Dash shell assignment](https://junglewise.ai/threats/cve-2026-73411-shescape-home-directory-disclosure-in-dash-shell-assignment)
- [Shescape escape() bracket glob expansion bypass on Bash, BusyBox, and Dash](https://junglewise.ai/threats/cve-2026-32094-shescape-escape-bracket-glob-expansion-bypass-on-bash-busybox-and)
