VDB
Sign up
MEDIUM6.1

PYSEC-2026-4294

pymongo: PYTHON-5994 Use exact match for file ID in GridFS delete methods

Quick fix

PYSEC-2026-4294 — pymongo: upgrade to the fixed version with the command below.

pip install --upgrade 'pymongo>=4.18.1'

Details

### 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.

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI/pymongo
Introduced in: 0Fixed in: 4.18.1
Fixpip install --upgrade 'pymongo>=4.18.1'

References

Check it before you install it

One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.

curl -s https://vdb.ai.kr/v1/ai/check-packages \
  -H 'Content-Type: application/json' \
  -d '{"packages":["pkg:pypi/pymongo"]}'