Junglewise Threat Intelligence

CVE-2022-25918: shescape inefficient regex complexity

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

Technologies: Ericcornelissen Shescape. Vendors: npm.

Executive brief

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.

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

Timeline

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

References

Related threats