CVE-2022-24713: CWE-400: Uncontrolled Resource Consumption in rust-lang regex
regex is an implementation of regular expressions for the Rust language. The regex crate features built-in mitigations to prevent denial of service attacks caused by untrusted regexes, or untrusted input matched by trusted regexes. Those (tunable) mitigations already provide sane defaults to prevent attacks. This guarantee is documented and it's considered part of the crate's API. Unfortunately a bug was discovered in the mitigations designed to prevent untrusted regexes to take an arbitrary amount of time during parsing, and it's possible to craft regexes that bypass such mitigations. This makes it possible to perform denial of service attacks by sending specially crafted regexes to services accepting user-controlled, untrusted regexes. All versions of the regex crate before or equal to 1.5.4 are affected by this issue. The fix is include starting from regex 1.5.5. All users accepting user-controlled regexes are recommended to upgrade immediately to the latest version of the regex crate. Unfortunately there is no fixed set of problematic regexes, as there are practically infinite regexes that could be crafted to exploit this vulnerability. Because of this, it us not recommend to deny known problematic regexes.
AI Analysis
Technical Summary
CVE-2022-24713 is a vulnerability classified under CWE-400 (Uncontrolled Resource Consumption) affecting the 'regex' crate, a widely used Rust language library for regular expression processing. The regex crate includes built-in mitigations designed to prevent denial of service (DoS) attacks that could arise from processing untrusted regular expressions or untrusted input matched against trusted regexes. These mitigations are tunable and provide sane defaults to limit resource consumption during regex parsing and execution. However, a bug was discovered in these mitigation mechanisms in versions of the regex crate up to and including 1.5.4. This bug allows an attacker to craft specially designed regular expressions that bypass the resource consumption limits during parsing, enabling the regex engine to consume excessive CPU and memory resources. This uncontrolled resource consumption can lead to denial of service conditions on systems that accept user-supplied regex patterns. The vulnerability does not have a fixed set of problematic regexes due to the practically infinite ways regexes can be constructed to exploit this flaw, making blacklist-based defenses ineffective. The issue was fixed starting with regex crate version 1.5.5. The vulnerability is relevant primarily to applications and services that accept user-controlled regex patterns for processing, such as search engines, data validation tools, or any Rust-based software exposing regex functionality to untrusted inputs. No known exploits have been reported in the wild as of the publication date. The vulnerability was publicly disclosed on March 8, 2022.
Potential Impact
For European organizations, the impact of CVE-2022-24713 can be significant in scenarios where Rust-based applications accept user-supplied regular expressions. Exploitation can lead to denial of service by exhausting CPU and memory resources, potentially causing service outages or degraded performance. This can affect web services, APIs, or backend systems relying on Rust regex processing, leading to operational disruptions and potential loss of availability. Organizations in sectors with high reliance on Rust applications for data processing, such as fintech, telecommunications, and software development firms, may face increased risk. Additionally, denial of service conditions can indirectly impact confidentiality and integrity if system failures trigger fallback mechanisms or data corruption. Given the lack of known exploits, the immediate threat level is moderate, but the ease of crafting malicious regexes and the infinite attack surface mean that unpatched systems remain vulnerable to targeted or opportunistic attacks. The vulnerability could also be leveraged as part of multi-stage attacks to degrade defenses or distract security teams.
Mitigation Recommendations
European organizations should prioritize upgrading all Rust regex crate dependencies to version 1.5.5 or later to ensure the vulnerability is patched. For applications that accept user-controlled regex input, implement strict input validation and sanitization to limit the complexity and length of regex patterns, thereby reducing the risk of resource exhaustion. Employ runtime monitoring and resource usage limits (e.g., CPU timeouts, memory caps) on regex processing threads or containers to detect and terminate excessive resource consumption promptly. Consider isolating regex processing in sandboxed environments to contain potential DoS impacts. Developers should avoid relying on blacklists of known problematic regexes due to the infinite variety of exploit patterns. Instead, adopt whitelisting approaches or restrict regex features allowed from untrusted sources. Regularly audit and test regex handling code for performance bottlenecks and potential abuse vectors. Finally, maintain up-to-date dependency management practices and monitor Rust crate advisories to respond swiftly to similar vulnerabilities.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark, Ireland
CVE-2022-24713: CWE-400: Uncontrolled Resource Consumption in rust-lang regex
Description
regex is an implementation of regular expressions for the Rust language. The regex crate features built-in mitigations to prevent denial of service attacks caused by untrusted regexes, or untrusted input matched by trusted regexes. Those (tunable) mitigations already provide sane defaults to prevent attacks. This guarantee is documented and it's considered part of the crate's API. Unfortunately a bug was discovered in the mitigations designed to prevent untrusted regexes to take an arbitrary amount of time during parsing, and it's possible to craft regexes that bypass such mitigations. This makes it possible to perform denial of service attacks by sending specially crafted regexes to services accepting user-controlled, untrusted regexes. All versions of the regex crate before or equal to 1.5.4 are affected by this issue. The fix is include starting from regex 1.5.5. All users accepting user-controlled regexes are recommended to upgrade immediately to the latest version of the regex crate. Unfortunately there is no fixed set of problematic regexes, as there are practically infinite regexes that could be crafted to exploit this vulnerability. Because of this, it us not recommend to deny known problematic regexes.
AI-Powered Analysis
Technical Analysis
CVE-2022-24713 is a vulnerability classified under CWE-400 (Uncontrolled Resource Consumption) affecting the 'regex' crate, a widely used Rust language library for regular expression processing. The regex crate includes built-in mitigations designed to prevent denial of service (DoS) attacks that could arise from processing untrusted regular expressions or untrusted input matched against trusted regexes. These mitigations are tunable and provide sane defaults to limit resource consumption during regex parsing and execution. However, a bug was discovered in these mitigation mechanisms in versions of the regex crate up to and including 1.5.4. This bug allows an attacker to craft specially designed regular expressions that bypass the resource consumption limits during parsing, enabling the regex engine to consume excessive CPU and memory resources. This uncontrolled resource consumption can lead to denial of service conditions on systems that accept user-supplied regex patterns. The vulnerability does not have a fixed set of problematic regexes due to the practically infinite ways regexes can be constructed to exploit this flaw, making blacklist-based defenses ineffective. The issue was fixed starting with regex crate version 1.5.5. The vulnerability is relevant primarily to applications and services that accept user-controlled regex patterns for processing, such as search engines, data validation tools, or any Rust-based software exposing regex functionality to untrusted inputs. No known exploits have been reported in the wild as of the publication date. The vulnerability was publicly disclosed on March 8, 2022.
Potential Impact
For European organizations, the impact of CVE-2022-24713 can be significant in scenarios where Rust-based applications accept user-supplied regular expressions. Exploitation can lead to denial of service by exhausting CPU and memory resources, potentially causing service outages or degraded performance. This can affect web services, APIs, or backend systems relying on Rust regex processing, leading to operational disruptions and potential loss of availability. Organizations in sectors with high reliance on Rust applications for data processing, such as fintech, telecommunications, and software development firms, may face increased risk. Additionally, denial of service conditions can indirectly impact confidentiality and integrity if system failures trigger fallback mechanisms or data corruption. Given the lack of known exploits, the immediate threat level is moderate, but the ease of crafting malicious regexes and the infinite attack surface mean that unpatched systems remain vulnerable to targeted or opportunistic attacks. The vulnerability could also be leveraged as part of multi-stage attacks to degrade defenses or distract security teams.
Mitigation Recommendations
European organizations should prioritize upgrading all Rust regex crate dependencies to version 1.5.5 or later to ensure the vulnerability is patched. For applications that accept user-controlled regex input, implement strict input validation and sanitization to limit the complexity and length of regex patterns, thereby reducing the risk of resource exhaustion. Employ runtime monitoring and resource usage limits (e.g., CPU timeouts, memory caps) on regex processing threads or containers to detect and terminate excessive resource consumption promptly. Consider isolating regex processing in sandboxed environments to contain potential DoS impacts. Developers should avoid relying on blacklists of known problematic regexes due to the infinite variety of exploit patterns. Instead, adopt whitelisting approaches or restrict regex features allowed from untrusted sources. Regularly audit and test regex handling code for performance bottlenecks and potential abuse vectors. Finally, maintain up-to-date dependency management practices and monitor Rust crate advisories to respond swiftly to similar vulnerabilities.
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-02-10T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9842c4522896dcbf26d5
Added to database: 5/21/2025, 9:09:22 AM
Last enriched: 6/23/2025, 3:17:15 PM
Last updated: 7/26/2025, 1:04:21 AM
Views: 13
Related Threats
CVE-2025-8533: CWE-863 Incorrect Authorization in Flexibits Fantastical
MediumCVE-2025-35970: Use of weak credentials in SEIKO EPSON Multiple EPSON product
HighCVE-2025-29866: CWE-73: External Control of File Name or Path in TAGFREE X-Free Uploader
HighCVE-2025-32094: CWE-444 Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') in Akamai AkamaiGhost
MediumCVE-2025-8583: Inappropriate implementation in Google Chrome
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.