CVE-2024-5629: Out-of-bounds read in bson module of PyMongo
An out-of-bounds read in the 'bson' module of PyMongo 4.6.2 or earlier allows deserialization of malformed BSON provided by a Server to raise an exception which may contain arbitrary application memory.
Other sources
Versions of the package pymongo before 4.6.3 are vulnerable to Out-of-bounds Read in the bson module. Using the crafted payload the attacker could force the parser to deserialize unmanaged memory. The parser tries to interpret bytes next to buffer and throws an exception with string. If the following bytes are not printable UTF-8 the parser throws an exception with a single byte.
— GitHub
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pymongoto a version that resolves this vulnerability.Fixed in 4.6.3 - Upgrade
Upgrade
debian/pymongoto a version that resolves this vulnerability.Fixed in 3.11.0-1+deb12u1Fixed in 4.7.3-1 - Upgrade
Upgrade
ubuntu/pymongoto a version that resolves this vulnerability.Fixed in 3.6.1+dfsg1-1ubuntu0.1~ - Upgrade
Upgrade
ubuntu/pymongoto a version that resolves this vulnerability.Fixed in 3.10.1-0ubuntu2.1 - Upgrade
Upgrade
ubuntu/pymongoto a version that resolves this vulnerability.Fixed in 3.11.0-1ubuntu0.22.04.1 - Upgrade
Upgrade
ubuntu/pymongoto a version that resolves this vulnerability.Fixed in 3.11.0-1ubuntu0.24.04.1 - Upgrade
Upgrade
ubuntu/pymongoto a version that resolves this vulnerability.Fixed in 3.2-1ubuntu0.1~ - Upgrade
Upgrade
redhat/pymongoto a version that resolves this vulnerability.Fixed in 4.6.3 - Upgrade
Upgrade
pymongoto a version that resolves this vulnerability.Fixed in 4.6.3
Event History
Frequently Asked Questions
What is the severity of CVE-2024-5629?
CVE-2024-5629 is classified as a high severity vulnerability due to its potential for arbitrary application memory exposure.
How do I fix CVE-2024-5629?
To fix CVE-2024-5629, upgrade to PyMongo version 4.6.3 or later.
What causes CVE-2024-5629 in PyMongo?
CVE-2024-5629 is caused by an out-of-bounds read in the 'bson' module that allows deserialization of malformed BSON.
Which versions of PyMongo are affected by CVE-2024-5629?
Versions of PyMongo prior to 4.6.3 are affected by CVE-2024-5629.
Are there alternative ways to mitigate CVE-2024-5629?
Users can limit the exposure of their applications to untrusted BSON data as an alternative mitigation strategy for CVE-2024-5629.