PyMongo CVE-2026-135146: update each application's driver
MongoDB’s CNA rates CVE-2026-135146 CVSS 4.0 9.1 Critical and CVSS 3.1 7.4 High. The CVE record, published November 25, 2026, identifies PyMongo 3.11.0 up to, excluding, 4.20.2 as affected. MongoDB’s 4.20.2 release provides the update.
Update the application dependency
The issue concerns the Python driver’s optional certificate-revocation checking support. Treat it as a client-library update: a MongoDB server upgrade does not replace the PyMongo copies bundled with applications.
Inventory each application’s resolved dependency and deployed environment, including background workers and independently built images. Update to 4.20.2 or a later supported release, refresh the dependency lockfile where used, and rebuild the application artifact. A move from a 3.x driver requires the normal compatibility review rather than an assumed drop-in update.
Check a synthetic inventory
This example ran on Linux with Python 3.12.14. It reads only invented records; it does not inspect an installation, contact a service or test the vulnerability. Save it as pymongo_inventory.py in an empty working directory.
records = {"worker-a": "3.11.0", "worker-b": "4.20.1", "worker-c": "4.20.2"}
for name, version in records.items():
parts = tuple(int(part) for part in version.split("."))
affected = (3, 11, 0) <= parts < (4, 20, 2)
result = "in affected interval" if affected else "outside this interval"
print(f"{name}: {version} -> {result}")Run it:
python3 pymongo_inventory.pyActual output:
worker-a: 3.11.0 -> in affected interval
worker-b: 4.20.1 -> in affected interval
worker-c: 4.20.2 -> outside this intervalThe comparison accepts the three-part numeric versions shown here. It does not handle prereleases or vendor package revisions, and a matching version alone does not establish which files a running service uses. Delete the saved example file after use.
Check the running application
After rollout, verify the resolved PyMongo version in each deployed environment and restart or replace application processes using the old artifact. Run the application’s normal trusted database integration tests and confirm expected connection health. Retain certificate verification and the intended revocation policy during maintenance.
For distribution packages with backports, use the distributor’s CVE-specific advisory and installed package revision. Record the application build and dependency evidence together; a corrected lockfile alone does not show that all workers were redeployed.
Acknowledgements
This post was created with assistance from AI.