{"id":"CVE-2022-25918","aliases":["GHSA-cr84-xvw4-qx3c"],"url":"https://o3.security/vulnerability/CVE-2022-25918","summary":"Regular Expression Denial of Service (ReDoS)","details":"### Impact\n\nThis impacts users that use shescape to escape arguments:\n\n- for the Unix shell Bash, or any not-officially-supported Unix shell;\n- using the `escape` or `escapeAll` functions with the `interpolation` option set to `true`.\n\nAn 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:\n\n```javascript\nimport * as shescape from \"shescape\";\n\n/* 1. Prerequisites */\nconst options = {\n  interpolation: true,\n  // and\n  shell: \"/bin/bash\",\n  // or\n  shell: \"some-not-officially-supported-shell\",\n  // or\n  shell: undefined, // Only if the system's default shell is bash or an unsupported shell.\n};\n\n/* 2. Attack */\nlet userInput = '{,'.repeat(150_000); // polynomial backtracking\n\n/* 3. Usage */\nshescape.escape(userInput, options);\n// or\nshescape.escapeAll([userInput], options);\n```\n\n### Patches\n\nThis 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.\n\n### Workarounds\n\nAlternatively, 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.\n\n### References\n\n- Shescape commit [552e8ea](https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9)\n- Shescape Release [v1.6.1](https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1)\n\n### For more information\n\n- Comment on commit [552e8ea](https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9)\n- 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)\n","published":"2022-10-27T05:05:09.944Z","modified":"2026-08-12T03:51:19.453195298Z","cvss":{"score":5.3,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"},"epss":{"score":0.01282,"percentile":0.67381,"asOf":"2026-08-23"},"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"npm","name":"shescape","fixedVersion":"1.6.1"}],"fix":{"url":"https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9","label":"ericcornelissen/shescape@552e8ea"},"references":[{"type":"WEB","url":"https://github.com/ericcornelissen/shescape/blob/main/src/unix.js%23L52"},{"type":"WEB","url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.6.1"},{"type":"WEB","url":"https://security.snyk.io/vuln/SNYK-JS-SHESCAPE-3061108"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/25xxx/CVE-2022-25918.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-25918"},{"type":"FIX","url":"https://github.com/ericcornelissen/shescape/commit/552e8eab56861720b1d4e5474fb65741643358f9"},{"type":"WEB","url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-cr84-xvw4-qx3c"},{"type":"PACKAGE","url":"https://github.com/ericcornelissen/shescape"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:19.453195298Z"}}