CVE-2022-36064: CWE-1333: Inefficient Regular Expression Complexity in ericcornelissen shescape
Shescape is a shell escape package for JavaScript. An Inefficient Regular Expression Complexity vulnerability impacts users that use Shescape to escape arguments for the Unix shells `Bash` and `Dash`, or any not-officially-supported Unix shell; and/or using the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. An attacker can cause polynomial backtracking or quadratic runtime in terms of the input string length due to two Regular Expressions in Shescape that are vulnerable to Regular Expression Denial of Service (ReDoS). This bug has been patched in v1.5.10. For `Dash` only, this bug has been patched since v1.5.9. As a workaround, 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.
AI Analysis
Technical Summary
CVE-2022-36064 is a vulnerability identified in the JavaScript package 'shescape', developed by ericcornelissen, which is used to safely escape shell arguments for Unix shells such as Bash and Dash. The vulnerability arises from inefficient regular expression complexity in two specific regular expressions used within the package. When the 'escape' or 'escapeAll' functions are invoked with the 'interpolation' option set to true, these regular expressions can exhibit polynomial or quadratic runtime relative to the input string length. This behavior leads to a Regular Expression Denial of Service (ReDoS) condition, where an attacker can supply crafted input strings that cause excessive CPU consumption due to backtracking in the regex engine. The affected versions are from 1.5.1 up to but not including 1.5.10, with the Dash shell-specific fix introduced in version 1.5.9 and a full patch in 1.5.10. The vulnerability does not require user authentication or interaction beyond supplying input to the vulnerable functions. No known exploits have been reported in the wild. As a mitigation, limiting the maximum length of input strings passed to shescape can reduce the risk, but attempting to detect malicious input patterns is discouraged since detection logic may itself be vulnerable to ReDoS. The root cause is classified under CWE-1333 (Inefficient Regular Expression Complexity) and CWE-400 (Uncontrolled Resource Consumption).
Potential Impact
The primary impact of this vulnerability is a denial of service condition caused by excessive CPU consumption when processing specially crafted input strings. For European organizations using shescape in their JavaScript applications—particularly those that escape shell commands for Bash, Dash, or other Unix shells—this could lead to service degradation or outages if an attacker can influence input to the vulnerable functions. This is especially relevant for web services, automation scripts, or CI/CD pipelines that rely on shescape for shell command construction. While the vulnerability does not directly compromise confidentiality or integrity, the availability impact can disrupt business operations, cause delays, or trigger cascading failures in dependent systems. Given the widespread use of JavaScript and Unix shells in European IT environments, organizations with public-facing applications or internal tools that incorporate shescape are at risk. The absence of authentication requirements means that an attacker could exploit this vulnerability remotely if input vectors are exposed. However, since no exploits are currently known in the wild, the immediate risk is moderate but warrants prompt remediation to prevent potential abuse.
Mitigation Recommendations
Upgrade all instances of the shescape package to version 1.5.10 or later, which contains the official patch for this vulnerability. If immediate upgrade is not feasible, implement input validation to enforce strict maximum length limits on strings passed to the 'escape' and 'escapeAll' functions with the 'interpolation' option enabled, thereby reducing the risk of triggering ReDoS. Avoid attempting to detect malicious input patterns for ReDoS, as such detection logic can itself be vulnerable to similar attacks. Review and audit all codebases and dependencies that utilize shescape, especially those that handle untrusted or user-supplied input, to identify and remediate vulnerable usage patterns. Implement runtime monitoring and alerting for abnormal CPU usage or performance degradation in services that use shescape, enabling early detection of potential exploitation attempts. Consider sandboxing or isolating processes that execute shell commands constructed via shescape to limit the impact of potential denial of service conditions. Engage in secure coding practices by minimizing reliance on complex regular expressions for input processing and prefer safer parsing methods where possible.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark, Ireland, Belgium
CVE-2022-36064: CWE-1333: Inefficient Regular Expression Complexity in ericcornelissen shescape
Description
Shescape is a shell escape package for JavaScript. An Inefficient Regular Expression Complexity vulnerability impacts users that use Shescape to escape arguments for the Unix shells `Bash` and `Dash`, or any not-officially-supported Unix shell; and/or using the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. An attacker can cause polynomial backtracking or quadratic runtime in terms of the input string length due to two Regular Expressions in Shescape that are vulnerable to Regular Expression Denial of Service (ReDoS). This bug has been patched in v1.5.10. For `Dash` only, this bug has been patched since v1.5.9. As a workaround, 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.
AI-Powered Analysis
Technical Analysis
CVE-2022-36064 is a vulnerability identified in the JavaScript package 'shescape', developed by ericcornelissen, which is used to safely escape shell arguments for Unix shells such as Bash and Dash. The vulnerability arises from inefficient regular expression complexity in two specific regular expressions used within the package. When the 'escape' or 'escapeAll' functions are invoked with the 'interpolation' option set to true, these regular expressions can exhibit polynomial or quadratic runtime relative to the input string length. This behavior leads to a Regular Expression Denial of Service (ReDoS) condition, where an attacker can supply crafted input strings that cause excessive CPU consumption due to backtracking in the regex engine. The affected versions are from 1.5.1 up to but not including 1.5.10, with the Dash shell-specific fix introduced in version 1.5.9 and a full patch in 1.5.10. The vulnerability does not require user authentication or interaction beyond supplying input to the vulnerable functions. No known exploits have been reported in the wild. As a mitigation, limiting the maximum length of input strings passed to shescape can reduce the risk, but attempting to detect malicious input patterns is discouraged since detection logic may itself be vulnerable to ReDoS. The root cause is classified under CWE-1333 (Inefficient Regular Expression Complexity) and CWE-400 (Uncontrolled Resource Consumption).
Potential Impact
The primary impact of this vulnerability is a denial of service condition caused by excessive CPU consumption when processing specially crafted input strings. For European organizations using shescape in their JavaScript applications—particularly those that escape shell commands for Bash, Dash, or other Unix shells—this could lead to service degradation or outages if an attacker can influence input to the vulnerable functions. This is especially relevant for web services, automation scripts, or CI/CD pipelines that rely on shescape for shell command construction. While the vulnerability does not directly compromise confidentiality or integrity, the availability impact can disrupt business operations, cause delays, or trigger cascading failures in dependent systems. Given the widespread use of JavaScript and Unix shells in European IT environments, organizations with public-facing applications or internal tools that incorporate shescape are at risk. The absence of authentication requirements means that an attacker could exploit this vulnerability remotely if input vectors are exposed. However, since no exploits are currently known in the wild, the immediate risk is moderate but warrants prompt remediation to prevent potential abuse.
Mitigation Recommendations
Upgrade all instances of the shescape package to version 1.5.10 or later, which contains the official patch for this vulnerability. If immediate upgrade is not feasible, implement input validation to enforce strict maximum length limits on strings passed to the 'escape' and 'escapeAll' functions with the 'interpolation' option enabled, thereby reducing the risk of triggering ReDoS. Avoid attempting to detect malicious input patterns for ReDoS, as such detection logic can itself be vulnerable to similar attacks. Review and audit all codebases and dependencies that utilize shescape, especially those that handle untrusted or user-supplied input, to identify and remediate vulnerable usage patterns. Implement runtime monitoring and alerting for abnormal CPU usage or performance degradation in services that use shescape, enabling early detection of potential exploitation attempts. Consider sandboxing or isolating processes that execute shell commands constructed via shescape to limit the impact of potential denial of service conditions. Engage in secure coding practices by minimizing reliance on complex regular expressions for input processing and prefer safer parsing methods where possible.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-07-15T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9849c4522896dcbf68ea
Added to database: 5/21/2025, 9:09:29 AM
Last enriched: 6/21/2025, 11:41:34 PM
Last updated: 8/17/2025, 2:47:11 PM
Views: 13
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.