CVE-2024-6381
Medium · 4.0CVSS
4.0
EPSS
0.4%
Published
Jul 2, 2024
CISA due date
—
Cloudanix analysis
A bug in a support library for MongoDB apps could let specially crafted data cause memory problems and crashes on the same computer.
- Exploitation
- Local Privilege
- Attacker needs
- Local User
- Complexity
- Low
- Impact
- Data Tampering
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Integer overflow in bson_strfreev causes attempt to free memory at a negative offset, resulting in memory corruption within the libbson library.
Why it matters to the business
Applications using older MongoDB C driver versions may experience crashes or data integrity issues when processing certain inputs, increasing operational risk for dependent systems until upgraded.
How an attack unfolds
An attacker supplies crafted input that triggers the integer overflow in bson_strfreev during local processing, leading to memory corruption that may be leveraged for further impact such as denial of service.
How to fix it
Upgrade mongodb/mongo-c-driver to the fixed commit 586171d661f584d841bdc32fc998e9f6cf903228 or later equivalent release containing the libbson 1.26.2 fix.
How to confirm the fix worked
Verify installed libbson version is 1.26.2 or newer; confirm presence of the correcting commit in source; test with inputs that previously triggered the overflow to ensure no crash or corruption occurs.
Typical attack path
- Identify application using vulnerable libbson version prior to 1.26.2
- Craft input that causes integer overflow in bson_strfreev
- Trigger function execution to induce memory corruption at negative offset
- Observe resulting application instability or corruption effects
How to detect it
Review application logs and crash dumps for references to bson_strfreev failures or memory errors; inspect process behavior around BSON parsing functions for signs of corruption.
- bson_strfreev
What your security team should do
- Immediately update all instances of mongo-c-driver to the fixed commit version
- Scan codebases and dependency manifests for references to vulnerable libbson versions
- Monitor for application crashes involving bson_strfreev and prioritize patching in high-usage environments
The record
The bson_strfreev function in the MongoDB C driver library may be susceptible to an integer overflow where the function will try to free memory at a negative offset. This may result in memory corruption. This issue affected libbson versions prior to 1.26.2
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | libbson-xs-perl | 0 | 0.8.4-1+deb11u1 |
| Debian:11 | mongo-c-driver | 0 | No fix |
| Debian:12 | libbson-xs-perl | 0 | No fix |
| Debian:12 | mongo-c-driver | 0 | No fix |
| Debian:13 | mongo-c-driver | 0 | 1.26.2-1 |
| Ubuntu:20.04:LTS | mongo-c-driver | 0 | No fix |
| Ubuntu:22.04:LTS | mongo-c-driver | 0 | No fix |
| Ubuntu:24.04:LTS | mongo-c-driver | 0 | No fix |
| Ubuntu:24.10 | mongo-c-driver | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | libbson | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | libbson | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | mongo-c-driver | 0 | 1.16.1-1ubuntu0.1~esm1 |
| Ubuntu:Pro:22.04:LTS | mongo-c-driver | 0 | 1.21.0-1ubuntu0.1~esm1 |
| Ubuntu:Pro:24.04:LTS | mongo-c-driver | 0 | 1.26.0-1.1ubuntu2+esm1 |
Related vulnerabilities
- CVE-2024-6383 The bson_string_append function in MongoDB C Driver may be vulnerable to a buffer… Also affects libbson-xs-perl
- CVE-2017-14227 In MongoDB libbson 1.7.0, the bson_iter_codewscope function in bson-iter.c miscalculates… Also affects libbson-xs-perl
- CVE-2024-7553 Incorrect validation of files loaded from a local untrusted directory may allow local… Also affects mongo-c-driver
- CVE-2026-76825 RestrictedPython is a tool that helps define a subset of the Python language for… CWE-680
- CVE-2026-81647 Out-of-bounds read vulnerability in the graphics module. CWE-680
- CVE-2026-19313 An heap overflow vulnerability in the WatchGuard Fireware OS iked process allows a remote… CWE-680
- CVE-2026-55200 libssh2 through 1.11.1, fixed in commit 7acf3df contains an out-of-bounds write… CWE-680
- CVE-2026-8376 Perl versions before 5.40.5-RC1, from 5.41.0 before 5.42.3-RC1, from 5.43.0 before… CWE-680