CVE-2022-24713

7.5 HIGH

📋 TL;DR

CVE-2022-24713 is a vulnerability in the Rust regex crate where built-in mitigations against regex-based denial of service attacks can be bypassed. This allows attackers to craft malicious regexes that cause excessive CPU consumption and service disruption. Only applications that accept user-controlled regexes as input are affected.

💻 Affected Systems

Products:
  • Rust applications using regex crate
Versions: All versions <= 1.5.4
Operating Systems: All operating systems running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable if application accepts user-controlled regex patterns. Applications using only hardcoded regex patterns are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to CPU exhaustion, potentially affecting all users of the vulnerable service.

🟠

Likely Case

Degraded performance or temporary service disruption for applications accepting user regex input.

🟢

If Mitigated

No impact if regex crate is updated or if applications don't accept user regexes.

🌐 Internet-Facing: HIGH for services accepting user regex input, as exploitation requires no authentication.
🏢 Internal Only: MEDIUM for internal services accepting user regex input, lower for others.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted regex patterns to vulnerable endpoints. No authentication needed if service accepts regex input from unauthenticated users.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: regex 1.5.5 and later

Vendor Advisory: https://github.com/rust-lang/regex/security/advisories/GHSA-m5pq-gvj9-9vr8

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require regex >= 1.5.5
2. Run 'cargo update regex'
3. Rebuild and redeploy application
4. Restart affected services

🔧 Temporary Workarounds

Input validation and sanitization

all

Implement strict validation to reject complex regex patterns from untrusted sources

Rate limiting regex processing

all

Implement timeouts or rate limits on regex parsing operations

🧯 If You Can't Patch

  • Disable user-controlled regex input entirely if not required
  • Implement strict WAF rules to block suspicious regex patterns at network boundary

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock or Cargo.toml for regex crate version <= 1.5.4

Check Version:

grep -A 1 'name = "regex"' Cargo.lock

Verify Fix Applied:

Verify regex crate version is >= 1.5.5 in Cargo.lock after update

📡 Detection & Monitoring

Log Indicators:

  • Unusually long regex processing times
  • High CPU usage spikes from regex operations
  • Repeated regex parsing failures

Network Indicators:

  • Incoming requests containing complex regex patterns
  • Traffic patterns showing regex submission attempts

SIEM Query:

source="application_logs" AND (message="*regex*" AND duration>5s) OR (process="rust_app" AND cpu_usage>90%)

🔗 References

📤 Share & Export