CVE-2024-6381

4.0 MEDIUM

📋 TL;DR

The bson_strfreev function in MongoDB's C driver library contains an integer overflow vulnerability that can cause memory corruption when freeing memory at a negative offset. This affects applications using libbson versions before 1.26.2. The vulnerability could potentially lead to crashes or arbitrary code execution in affected systems.

💻 Affected Systems

Products:
  • MongoDB C Driver (libbson)
Versions: All versions prior to 1.26.2
Operating Systems: All platforms using vulnerable libbson
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the bson_strfreev function directly

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise if combined with other vulnerabilities

🟠

Likely Case

Application crash or denial of service due to memory corruption

🟢

If Mitigated

Limited impact with proper memory protections and exploit mitigations

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: LOW

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: HIGH

Exploitation requires specific conditions and memory manipulation

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.26.2

Vendor Advisory: https://jira.mongodb.org/browse/CDRIVER-5622

Restart Required: Yes

Instructions:

1. Identify libbson version currently installed. 2. Update to libbson 1.26.2 or later. 3. Recompile any applications using the library. 4. Restart affected services.

🔧 Temporary Workarounds

Avoid bson_strfreev usage

all

Modify code to avoid using the vulnerable bson_strfreev function

🧯 If You Can't Patch

  • Implement strict input validation and sanitization
  • Enable memory protection mechanisms like ASLR and DEP

🔍 How to Verify

Check if Vulnerable:

Check libbson version with: pkg-config --modversion libbson-1.0

Check Version:

pkg-config --modversion libbson-1.0

Verify Fix Applied:

Verify version is 1.26.2 or higher using same command

📡 Detection & Monitoring

Log Indicators:

  • Application crashes, segmentation faults, memory corruption errors

Network Indicators:

  • Unusual application behavior or service disruptions

SIEM Query:

Process termination with exit code 139 (SIGSEGV) from MongoDB-related processes

🔗 References

📤 Share & Export