The short version
- Affected: PyMongo 3.11.0 to 4.20.1, synchronous
MongoClientonly, and only when thepymongo[ocsp]packages are installed (CVE record, Jira PYTHON-6189).AsyncMongoClientis not affected. - Fixed in: PyMongo 4.20.2, released 25 November 2026 (changelog, GitHub release, PyPI). No Linux distribution had a 4.20.2 package on 26 November 2026.
- Severity: CVSS 4.0 9.1 Critical and CVSS 3.1 7.4 High, both from MongoDB as the CVE Numbering Authority. Red Hat rates it Important at 7.4 (Red Hat). NVD lists the record as Awaiting Analysis.
- Exploited: not known. CISA's SSVC note on the CVE record says exploitation none and automatable no, and the CVE is not in the CISA KEV catalogue.
- Do now: find every Python workload with
pymongobelow 4.20.2 andpyOpenSSLinstalled side by side, pinpymongo>=4.20.2, redeploy.
1. What CVE-2026-135146 is
PyMongo can check whether a MongoDB server's TLS certificate has been revoked. The check is optional: it runs only when PyMongo is installed as pymongo[ocsp], which pulls in pyOpenSSL, cryptography, requests and service_identity (TLS docs, ocsp.txt at 4.20.2). With those packages present, the synchronous driver builds its TLS context with pyOpenSSL and registers an OCSP callback. Without them, or in the async driver, it uses the standard library ssl module and does no OCSP work (ssl_support.py at 4.20.2).
An OCSP response is signed by the CA and names one certificate by serial number and issuer hashes. A MongoDB 4.4 or later server staples such a response to its certificate, and PyMongo verifies the signature and fails the connection if the status is revoked (TLS docs). Until 4.20.2 the driver never compared the response's identifiers with the certificate it had just been shown. Jira PYTHON-6189 puts it in one line: "PyMongo accepts a stapled OCSP response without verifying that it covers the presented TLS certificate" (Jira).
So an attacker who holds a revoked, must-staple certificate for your database hostname can staple a real, CA-signed "good" response for another certificate from the same CA. The driver accepts it and authenticates; Jira names "PLAIN passwords, OIDC tokens" as what then reaches the attacker. The fix is 12 lines in ocsp_support.py: compare the stapled response's serial number and issuer hashes with the presented certificate, and end the connection on mismatch, as the MongoDB OCSP specification suggests (fix commit, 25 November 2026, OCSP spec). The same release fixes CVE-2026-135898, an out-of-bounds read in the C BSON decoder (changelog).
2. Impact: who is exposed and how badly
This is a man-in-the-middle bug, not remote code execution. The attacker needs a revoked, still-dated certificate that chains to a CA your client trusts, a valid "good" response for another certificate from that CA, and a network position where your client's connection lands on their server. Given all three they read and alter database traffic and capture what the application sends to authenticate. MongoDB rates confidentiality and integrity High and availability None (Red Hat agrees).
| What you run | Affected | Fixed version |
|---|---|---|
pymongo from PyPI, synchronous client, ocsp extra installed | 3.11.0 to 4.20.1 | 4.20.2, 25 Nov 2026 (PyPI) |
pymongo without pyOpenSSL, or AsyncMongoClient | not affected (Jira) | upgrade anyway |
| Motor | depends on pymongo>=4.9,<5.0 (PyPI) | upgrade the pymongo underneath |
Debian python3-pymongo: sid 4.20.1-1, trixie 4.10.1-6, bookworm 3.11.0-1+deb12u1 (3.11.0-1+deb12u2 in bookworm-security, for earlier CVEs) | in range by version | none yet (Debian tracker, security tracker) |
| Ubuntu: 26.04 4.16.0-1build1, 25.10 4.10.1-6, 24.04 3.11.0-1ubuntu0.24.04.1, 22.04 3.11.0-1ubuntu0.22.04.1 | in range by version | none yet (Launchpad) |
Fedora python-pymongo: 4.20.1-1 (46), 4.13.2 (43 to 45) | in range | none yet (Bodhi) |
Amazon Linux 2023 python-pymongo | Not Affected per Amazon | Amazon Linux 2027 Preview: Pending Fix (ALAS) |
Red Hat Enterprise Linux 8 pymongo | Not affected per Red Hat; OpenShift AI listed as Affected | (Red Hat) |
| Alpine | no py3-pymongo package exists (Alpine packages) | pip |
Ubuntu 20.04 ships 3.10.1, below the range. The base distribution packages of pymongo do not depend on pyOpenSSL, so a host is exposed only if python3-openssl and the other extra packages are also installed; Fedora's python3-pymongo+ocsp subpackage pulls them in. Debian's security tracker lists the CVE with no package status yet, and Ubuntu's CVE page lists every release as "Needs evaluation" on 26 November 2026 (Ubuntu).
Not affected: applications without the ocsp extra, applications on AsyncMongoClient, connections without TLS, and the MongoDB server, Atlas and mongosh. MongoDB's C driver, libmongoc, has a separate revocation bug fixed the same day, CVE-2026-135224, which reaches the C++ and PHP drivers built on it (our page).
3. How to check if you are affected
- Version in the environment that runs. Below 4.20.2 is in range (pip show).
python -c "import pymongo; print(pymongo.version)"
pip show pymongo | grep -i ^version
- Is the OCSP code path active? PyMongo uses pyOpenSSL, and therefore OCSP, only when the extra's packages import; the module flag below is then
True(ssl_support.py).Falsemeans the bug cannot trigger, but upgrade anyway.
python -c "import pymongo.ssl_support as s; print(s.HAVE_PYSSL)"
pip show pyopenssl service_identity 2>/dev/null | grep -E '^(Name|Version)'
- Lockfiles and manifests. Look for the pin and for the extra.
grep -rn -E 'pymongo(\[ocsp\])?[=<>~]' requirements*.txt pyproject.toml setup.py setup.cfg Pipfile 2>/dev/null
grep -n -A1 'name = "pymongo"' poetry.lock uv.lock 2>/dev/null
- Container images. Run step 1 inside the image you deploy, and read the Dockerfile for the install line.
docker run --rm <your-image> python -c "import pymongo; print(pymongo.version)"
grep -n -E 'pymongo|requirements' Dockerfile
- Kubernetes and AWS ECS. List the images every workload runs, then apply step 4 to each (describe-task-definition).
kubectl get pods -A -o jsonpath='{range .items[*]}{.spec.containers[*].image}{"\n"}{end}' | sort -u
aws ecs describe-task-definition --task-definition <family> --query 'taskDefinition.containerDefinitions[*].image'
- AWS Lambda. No managed Python runtime includes pymongo, so it lives in your deployment package or a layer. List the layers, then check the lockfile that built each (get-function).
aws lambda get-function --function-name <name> --query 'Configuration.Layers[*].Arn'
- Hosts with the distribution package.
dpkg -l python3-pymongo python3-opensslorrpm -q python3-pymongo python3-pyOpenSSL. Both present and pymongo below 4.20.2 means affected.
4. How to fix it
- pip. Pin 4.20.2 or later and keep the extra if you use it (pip install). This changes the environment.
pip install --upgrade "pymongo[ocsp]>=4.20.2"
- Poetry and uv.
poetry update pymongooruv lock --upgrade-package pymongorewrites the lockfile (Poetry CLI, uv CLI). Check the new entry reads 4.20.2, then commit it.
- Motor. Motor accepts any pymongo from 4.9 to below 5.0, so the same pin applies and Motor itself needs no change (PyPI).
- Containers and Lambda. Change the pin in the file the image or layer is built from, rebuild, push and redeploy. A Lambda layer needs a new layer version and a function update to point at it.
- Debian, Ubuntu, Fedora. No fixed package existed on 26 November 2026. Watch the Debian tracker, Launchpad and Bodhi. Until then, install 4.20.2 from PyPI in a virtual environment for the affected application.
- Restart and confirm. Long-running workers keep the old module loaded until restarted. Repeat check step 1 against the running process, not the build host.
5. If you cannot patch today
MongoDB documents no workaround; the changelog, the Jira ticket and the CVE record give only the upgrade. Two facts limit what you can do:
tlsDisableOCSPEndpointCheck=truedoes not help. The docs say PyMongo "still verifies any OCSP response stapled to a server's certificate" with that option set, and the bug is in that stapled check (TLS docs).- Removing pyOpenSSL switches the driver to the standard library and removes the bug, but also removes every revocation check. That is a trade, not a fix.
Generic exposure cuts: keep MongoDB on a private network reachable only from application hosts, and resolve its hostname from DNS you control. Do not set tlsAllowInvalidCertificates=true in response.
6. How to tell if you were already hit
Nothing is published. The CVE record, the changelog and Red Hat's entry give no indicators of compromise and no attack reports. A successful attack looks like a normal TLS session from the client's side; evidence would be on the network, such as DNS answers for the database hostname pointing somewhere unexpected. After the upgrade, a rejected staple fails the handshake and the driver logs "Stapled OCSP response does not cover the peer certificate" at DEBUG level (fix commit). If you believe traffic was intercepted, assume the attacker holds what the application sent, including database credentials and OIDC tokens, and rotate them.
7. How autonomous DevOps handles a bug like this
Check steps 3 to 6 above are inventory questions: which lockfile pins pymongo at what version, which image each ECS task definition runs, which layers each Lambda carries, and what each Dockerfile installs. Compass, Beamreach's open-source operations agent for AWS, keeps that map current, including PyPI lockfile pins and whether the workload faces the internet (Compass). So "where do we run pymongo below 4.20.2" is a lookup, not a sweep.
This fix is the kind of change its patch pull requests make. Python is on Compass's default product list, pymongo is a direct dependency in a requirements file or lockfile, and the fix is a deterministic version change to 4.20.2. At CVSS 9.1 the finding is above the 7.0 threshold, so the pull request opens without a click, with the repository's CI and the image build read before anyone looks. It never merges (patching docs).
The limits are real. If pymongo reaches your application only through Motor or a framework, it is a transitive dependency, and Compass does not move those; that finding waits in the inbox. A Debian or Ubuntu python3-pymongo package is matched through the distribution trackers, and none carries a fix today. Compass covers AWS only, not Kubernetes clusters as such. Honeytokens do not help here: the attacker intercepts a network connection rather than running code inside the workload, so a decoy credential is never touched. Check step 2, reading the OCSP flag out of a running process, remains a person's job.
8. Sources
- PyMongo changelog, 4.20.2 entry: https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst
- PyMongo 4.20.2 GitHub release: https://github.com/mongodb/mongo-python-driver/releases/tag/4.20.2
- MongoDB Jira PYTHON-6189: https://jira.mongodb.org/browse/PYTHON-6189
- Fix commit: https://github.com/mongodb/mongo-python-driver/commit/71f335734be733dbacebf31fe5018cc20c08f4f7
- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-135146
- CVE record JSON: https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/135xxx/CVE-2026-135146.json
- NVD entry: https://nvd.nist.gov/vuln/detail/CVE-2026-135146
- Red Hat CVE page: https://access.redhat.com/security/cve/CVE-2026-135146
- Amazon Linux Security Center: https://explore.alas.aws.amazon.com/CVE-2026-135146.html
- PyMongo TLS and OCSP documentation: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/security/tls/
- MongoDB OCSP support specification: https://github.com/mongodb/specifications/blob/master/source/ocsp-support/ocsp-support.md
- PyMongo ocsp extra requirements at 4.20.2: https://github.com/mongodb/mongo-python-driver/blob/4.20.2/requirements/ocsp.txt
- PyMongo ssl_support.py at 4.20.2: https://github.com/mongodb/mongo-python-driver/blob/4.20.2/pymongo/ssl_support.py
- PyPI pymongo: https://pypi.org/project/pymongo/
- PyPI motor: https://pypi.org/project/motor/
- pip show: https://pip.pypa.io/en/stable/cli/pip_show/
- pip install: https://pip.pypa.io/en/stable/cli/pip_install/
- Poetry CLI: https://python-poetry.org/docs/cli/
- uv CLI reference: https://docs.astral.sh/uv/reference/cli/
- AWS CLI, ecs describe-task-definition: https://docs.aws.amazon.com/cli/latest/reference/ecs/describe-task-definition.html
- AWS CLI, lambda get-function: https://docs.aws.amazon.com/cli/latest/reference/lambda/get-function.html
- Debian package tracker: https://tracker.debian.org/pkg/pymongo
- Debian security tracker: https://security-tracker.debian.org/tracker/CVE-2026-135146
- Ubuntu Launchpad, pymongo: https://launchpad.net/ubuntu/+source/pymongo
- Fedora Bodhi, python-pymongo: https://bodhi.fedoraproject.org/updates/?packages=python-pymongo
- Alpine packages, py3-pymongo: https://pkgs.alpinelinux.org/packages?name=py3-pymongo
- CISA KEV catalogue: https://www.cisa.gov/known-exploited-vulnerabilities-catalog
- Beamreach page on CVE-2026-135224 (libmongoc): https://beamreach.ai/docs/cve-2026-135224-mongodb.html
- Compass patching docs: https://github.com/beamreach-ai/compass/blob/main/docs/patching.md
9. FAQ
Is my application affected by CVE-2026-135146?
Only if it uses PyMongo between 3.11.0 and 4.20.1, connects with the synchronous MongoClient over TLS, and has the ocsp extra's packages installed, above all pyOpenSSL. Run python -c "import pymongo.ssl_support as s; print(s.HAVE_PYSSL)" in the environment that runs: True with a version below 4.20.2 means affected. Applications on AsyncMongoClient, or without pyOpenSSL, are not affected.
Which version fixes CVE-2026-135146?
PyMongo 4.20.2, released on PyPI on 25 November 2026. No earlier branch received a fix, and Debian, Ubuntu and Fedora had no 4.20.2 package on 26 November 2026. Amazon Linux 2023 and Red Hat Enterprise Linux 8 say their packages are not affected.
Is CVE-2026-135146 being exploited?
Not as far as anyone has reported by 26 November 2026. The CVE is not in CISA's Known Exploited Vulnerabilities catalogue, and CISA's SSVC assessment says exploitation none and automatable no. The attack needs a revoked certificate for your database hostname plus a network position.
Is there a workaround for the PyMongo OCSP bug?
No. MongoDB documents only the upgrade. Setting tlsDisableOCSPEndpointCheck does not stop the stapled check where the bug lives. Uninstalling pyOpenSSL removes the bug but also all revocation checking.
Does CVE-2026-135146 affect MongoDB Atlas or the MongoDB server?
No. The flaw is in the client library. A Python application connecting to Atlas with an affected PyMongo would still accept a revoked certificate from an attacker between it and Atlas, so upgrade the client.
Last checked: 26 November 2026. Written from the vendor advisory and the CVE record, linked below. Confirm against the vendor advisory before acting.
Related: CVE Watch: all pages · How to protect against *2Shell vulnerabilities · Automated patching compared · AWS canary credentials
Beamreach