CVE-2022-25918: shescape inefficient regex complexity

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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.