CVE-2024-5991

7.5 HIGH

📋 TL;DR

CVE-2024-5991 is an out-of-bounds read vulnerability in wolfSSL's X509 certificate hostname validation. Attackers can cause the library to read beyond allocated memory boundaries when processing non-NULL terminated hostname buffers. This affects all applications using wolfSSL versions through 5.7.0 for TLS/SSL certificate validation.

💻 Affected Systems

Products:
  • wolfSSL
Versions: through 5.7.0
Operating Systems: All platforms running wolfSSL
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability triggers when X509_check_host() is called with non-NULL terminated buffers. Applications must explicitly call this function to be affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution or sensitive information disclosure through memory corruption leading to arbitrary code execution or data leakage.

🟠

Likely Case

Application crash (denial of service) or information disclosure from adjacent memory regions.

🟢

If Mitigated

Minimal impact with proper memory protections (ASLR, DEP) and input validation in calling applications.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires control over certificate hostname validation input. No public exploits known at this time.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: wolfSSL 5.7.1

Vendor Advisory: https://github.com/wolfSSL/wolfssl/pull/7604

Restart Required: Yes

Instructions:

1. Download wolfSSL 5.7.1 or later from official repository. 2. Replace vulnerable wolfSSL installation. 3. Recompile and relink applications using wolfSSL. 4. Restart affected services.

🔧 Temporary Workarounds

Input validation wrapper

all

Implement application-level validation to ensure hostname buffers are NULL terminated before calling X509_check_host()

// C code example: ensure buffer is NULL terminated
if (buffer[len-1] != '\0') { buffer[len] = '\0'; }

🧯 If You Can't Patch

  • Implement strict input validation for all certificate hostname parameters
  • Use network segmentation to isolate vulnerable systems from untrusted networks

🔍 How to Verify

Check if Vulnerable:

Check wolfSSL version: wolfSSL_lib_version() returns version string. Versions ≤5.7.0 are vulnerable.

Check Version:

wolfSSL_lib_version() or check package manager: rpm -q wolfssl, dpkg -l libwolfssl

Verify Fix Applied:

Verify wolfSSL version is ≥5.7.1 and check that MatchDomainName() properly validates buffer boundaries.

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory access violation errors in logs

Network Indicators:

  • Unusual TLS handshake failures
  • Abnormal certificate validation patterns

SIEM Query:

source="application_logs" AND ("segmentation fault" OR "memory violation" OR "out of bounds") AND process="*wolfssl*"

🔗 References

📤 Share & Export