GHSA-cr6f-gf5w-vhrc: Pymongo PyMongo Out-of-bounds Read Vulnerability
MODERATEGHSA-cr6f-gf5w-vhrc is a MODERATE (CVSS 5.2) pymongo out-of-bounds read vulnerability (CWE-125: Out-of-bounds Read) affecting Pymongo libraries in the PyPI ecosystem. The issue involves pymongo out-of-bounds read in the bson module. Remediation is available by upgrading affected packages to version 4.6.3.
GHSA-cr6f-gf5w-vhrc at a Glance
Security Impact
CVSS: 5.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L).
How to Fix GHSA-cr6f-gf5w-vhrc
To remediate this vulnerability, upgrade all affected Pymongo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pymongo>=4.6.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pymongo
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-cr6f-gf5w-vhrc, inspect your installed packages using pip:
pip show pymongo
Analyze the terminal output to locate any version of Pymongo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.3), your application is affected.
Note: The pip show pymongo command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Pymongo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-cr6f-gf5w-vhrc Affected Pymongo Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pymongo
|
PyPI |
< 4.6.3
|
4.6.3
|
References
Frequently Asked Questions
What is GHSA-cr6f-gf5w-vhrc?
Which Pymongo versions are affected?
What version fixes GHSA-cr6f-gf5w-vhrc?
Is pymongo affected?
What is the CVSS score of GHSA-cr6f-gf5w-vhrc?
What CWE is associated with GHSA-cr6f-gf5w-vhrc?
How can I check PyPI dependencies for GHSA-cr6f-gf5w-vhrc?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cr6f-gf5w-vhrc",
"modified" : "2024-06-05T17:11:58Z",
"published" : "2024-04-06T06:31:08Z",
"withdrawn" : "2024-06-05T17:11:58Z",
"aliases" : [ ],
"summary" : "PyMongo Out-of-bounds Read in the bson module ",
"details" : "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.\n\nThis advisory was initially published as CVE-2024-21506, which has since been rejected as a duplicate of CVE-2024-5629.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pymongo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.6.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21506"
}, {
"type" : "WEB",
"url" : "https://github.com/mongodb/mongo-python-driver/commit/56b6b6dbc267d365d97c037082369dabf37405d2"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/keltecc/62a7c2bf74a997d0a7b48a0ff3853a03"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/mongodb/mongo-python-driver"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-PYTHON-PYMONGO-6370597"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-04-08T15:40:17Z",
"nvd_published_at" : "2024-04-06T05:15:07Z"
}
}