CVE-2022-25918
highpriority · track · 31EPSS 0.016 · 76 %ileEUUSEPSS · scored 2026-10-27
The package shescape from 1.5.10 and before 1.6.1 are vulnerable to Regular Expression Denial of Service (ReDoS) via the escape function in index.js, due to the usage of insecure regex in the escapeArgBash function.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · medium–high · 5.3–7.5
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (5)
Products and version ranges known to be affected.
advisories (1)
Vendor and ecosystem advisories describing this.
- GHSA-cr84-xvw4-qx3cInefficient Regular Expression Complexity in shescape 2022-10-25ghsa · osvUS
### Impact This impacts users that use shescape to escape arguments: - for the Unix shell Bash, or any not-officially-supported Unix shell; - using the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. An attacker can cause polynomial backtracking in terms of the input string length due to a Regular Expression in shescape that is vulnerable to Regular Expression Denial of Service (ReDoS). Example: ```javascript import * as shescape from "shescape"; /* 1. Prerequisites */ const options = { interpolation: true, // and shell: "/bin/bash", // or shell: "some-not-officially-supported-shell", // or shell: undefined, // Only if the system's default shell is bash or an unsupported shell. }; /* 2. Attack */ let userInput = '{,'.repeat(150_000); // polynomial backtracking /* 3. Usage */ shescape.escape(userInput, options); // or shescape.escapeAll([userInput], options); ``` ### Patches This bug has been patched in [v1.6.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1) which you can upgrade to now. No further changes required. ### Workarounds Alternatively, a maximum length can be enforced on input strings to shescape to reduce the impact of the vulnerability. It is not recommended to try and detect vulnerable input strings, as the logic for this may end up being vulnerable to ReDoS itself. ### References - Shescape commit [552e8ea](https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9) - Shescape Release [v1.6.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1) ### For more information - Comment on commit [552e8ea](https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9) - Open an issue at [https://github.com/ericcornelissen/shescape/issues](https://github.com/ericcornelissen/shescape/issues?q=is%3Aissue+is%3Aopen) (New issue > Question > Get started)
also known as (3)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (13)
External citations — patches, advisories, analysis.
- https://cxsecurity.com/cveshow/CVE-2022-25918/cnnvd
- https://github.com/ericcornelissen/shescape/blob/main/src/unix.js%23L52cnnvd
- https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9cnnvd
- https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1cnnvd
- https://security.snyk.io/vuln/SNYK-JS-SHESCAPE-3061108cnnvd
- https://github.com/ericcornelissen/shescape/blob/main/src/unix.js%23L52enisa_euvd
- https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9enisa_euvd
- https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1enisa_euvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan