Executive brief
MongoDB's Python Driver contains a flaw in its GridFS component that allows specially crafted file identifiers to be misinterpreted as database queries. An authenticated attacker who can control the file identifiers used by an application could read unintended files, delete stored file chunks, or rename files other than intended, potentially causing data loss or unauthorized data access.
Technical details
The vulnerability is an improper neutralization of special elements in data query logic (CWE-89 style injection) affecting GridFS operations in the MongoDB Python Driver. The root cause is that user-supplied file identifiers are not properly escaped using equality matching ($eq) in database commands, allowing attackers to inject query logic. An authenticated user who can influence the file identifier parameter passed by an affected application can exploit operations like delete, rename, and read to access or modify unintended files. The fix, available in version 4.18.1, implements strict equality matching for all user-supplied GridFS file IDs using the $eq operator.
Affected products
- MongoDB Python Driver before 4.18.1
Timeline
- 2026-09-10: disclosed
- 2026-09-10: patched: Fix released in version 4.18.1