CVE-2026-88029: GridFS data disclosure and deletion via query-operator injection in file IDs in the MongoDB Python Driver
Impact
When reading/writing via an ID with the GridFS API, require an exact match on the given ID. Otherwise, if a Hash is given in place of the ID, it may be interpreted as criteria, overriding the ID match.
Patches Patch available in pymongo >= 4.18.1
Workarounds Ensure your existing workflow only supports exact matching on the GridFS API.
Other sources
Improper neutralization of special elements in data query logic in the GridFS component of the MongoDB Python Driver can cause a caller-supplied structured file identifier to be interpreted as a query condition rather than as a literal identifier. An authenticated user who can influence the identifier passed by an affected application may obtain stored file content beyond the intended target or cause all GridFS file chunks in the affected bucket to be removed, rendering stored file content unreadable. The affected rename operation may also rename a stored file other than the intended target.
— MITRE
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.18.1 - Upgrade
Upgrade
pymongoto a version that resolves this vulnerability.Fixed in 4.18.1 - Configuration
Require exact matching on the given file ID when reading, writing, or otherwise operating via the GridFS API; do not interpret structured IDs or hashes as query criteria.
GridFS API ID matching = exact match only
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using the MongoDB Python Driver's GridFS component are exposed if an authenticated user can influence the file identifier passed into affected GridFS operations. The attacker does not need user interaction and can exploit the issue remotely through the application.
What could an attacker do with control of a GridFS file identifier?
A structured identifier can be interpreted as a query condition instead of a literal ID. This may allow access to file content beyond the intended file, deletion of all file chunks in the affected bucket so stored content becomes unreadable, or renaming a different stored file.
How can we tell whether our application is at risk?
Review application paths that pass caller-controlled values as GridFS file identifiers, particularly operations that read, delete, or rename files. Risk exists when those values can be structured rather than being constrained to a literal identifier before they reach GridFS.