How long Python stacks keep trusting a compromised certificate authority
Browsers block a compromised certificate authority within hours. Python services keep trusting it until a package or the interpreter has been updated in every venv, image and lockfile. Using the eMudhra case, I show where the bundle lives and how to check it.
My analysis, written up with AI.
A Python service that opens an HTTPS connection decides, based on a list, which certificate authorities it trusts. In most stacks, that list is a file from a package that was installed at some point. You cannot tell from the running service how old the file is.
In October 2026, keys of the certificate authority eMudhra were reported as compromised. Using this case, I show where a Python stack stores its trust and why those places react more slowly than a browser.
1. What happened at eMudhra
On October 17, 2026, a security researcher reported to Mozilla, Google, Apple, Microsoft and eMudhra that eight intermediate certificates of the Indian certificate authority were compromised (Mozilla Bugzilla 2026). Six of them issue TLS certificates, two issue code signing certificates. Their P-384 private keys are tiny numbers, smaller than 256, and can therefore be computed from the public certificate. According to eMudhra’s preliminary account, the weak key pair was created in April 2025 by a code error in a test procedure during the key ceremony and was used for the certificate request because of similar names. Details on this are still open in the ticket. Sectigo had additionally cross-signed the same keys under the root “AAA Certificate Services”. eMudhra announced its final report for November 9; it had not been published when this text appeared.
Whoever has the keys can issue validly signed TLS certificates for any host. Mozilla reconstructed them itself, and several people did so independently. Dennis Jackson from Mozilla writes in comment 5 of the ticket: “I also tested some local agents who were able to recover the private key on their first attempt”. On October 20 and 21, 107,107 certificates using six of the keys were entered into two Certificate Transparency logs run by e-Szignó, 106,050 of them proofs of concept for google.com. So far there is no documented case in which traffic was intercepted with them.
2. Why the browser was protected and Python was not
In Chrome’s CRLSets, the six TLS keys could be seen as blocked as early as October 17 (22:46 UTC), and Firefox shipped a OneCRL update the same day. Microsoft followed on October 20, Apple on October 22, though Apple only for apps that use Apple’s frameworks. Command line tools and /etc/ssl/cert.pem are to follow with a later macOS update (Wayne 2026). Browsers also had a second safeguard: they require a certificate to appear in Certificate Transparency logs. A secretly issued certificate would have been missing there and would have been rejected.
Python clients do not have these mechanisms. The ssl module, on which urllib, requests and httpx build, does not check revocation lists by default and knows nothing about Certificate Transparency. These clients trust any chain that leads to a root in their bundle. The page about the incident says, in substance, that applications and libraries with their own CA bundle need a software update, and that an update of the operating system or browser may not be enough.
The TLS security of a Python service therefore depends on how fast a particular package or a new interpreter reaches every environment in which the service runs.
3. Where the bundle lives
certifi. The package contains the Mozilla bundle as a file, and requests uses it by default. Advisory GHSA-6q48-6c7w-9gw2 from October 20, 2026 classifies all versions from 2019.03.09 onward as affected. The advisory in the certifi repository, the GitHub database and OSV (where it is also listed as PYSEC-2026-4320) list 2026.10.18 as the fixed version, while GitHub and OSV recommend 2026.10.19 or newer in the text (certifi 2026; GitHub Advisory Database 2026a). 2026.10.18 had removed all emSign roots, and 2026.10.19 added back the unaffected ones. Seth Larson recommends at least 2026.10.19 on discuss.python.org (Larson 2026); the current version is 2026.10.23. The Sectigo root “AAA Certificate Services” is no longer included in current certifi versions, so the detour via the cross-signatures is closed there. According to Sectigo, it was still included in Microsoft’s and Apple’s root programs shortly after the report.
pip. pip ships its own copy of certifi and loads it in addition to the operating system’s store. The embedded bundle can only be bypassed with the deprecated option --use-deprecated=legacy-certs together with --cert (pypa/pip 2026c), or in pip packages patched by distributions. According to Christian Heimes, --cert or PIP_CERT only adds certificates, and certifi stays loaded (Larson 2026). An open issue proposes that pip use only the system store in future (pypa/pip 2026a). pip 26.2.2 from October 20 contains the new certifi as its only change, and pip 26.3 from November 2 ships certifi 2026.10.23 (pypa/pip 2026b).
uv. uv also embeds root certificates. Advisory GHSA-hq85-5cpj-mr62 names 0.13.4 as the first fixed version (GitHub Advisory Database 2026b). From 0.13.5, uv additionally rejects chains with the compromised keys (astral-sh/uv 2026).
CPython itself. Since the releases of October 25 (3.15.2, 3.14.10, 3.13.18, 3.12.16 and 3.11.18), the ssl module blocks chains with the compromised keys based on their SPKI hash, independent of the bundle (Heimes 2026; CVE Program 2026). This also covers the cross-signatures. Because requests and httpx verify their connections through the ssl module, the block applies there too, as long as verification is enabled. With CERT_NONE it does not apply. I reproduced this locally with my own test root and intermediate certificates using the same public keys: Python 3.14.10 rejects the chains via urllib, requests and httpx, while 3.14.0 accepts them. According to python.org, normal use of pip is protected by this, even without a pip update (Python Software Foundation 2026). Installers are only available for 3.15.2 and 3.14.10; the other three releases are source only.
venvs. A venv created with python -m venv gets the pip that the interpreter ships via ensurepip. For 3.11 and 3.12, this pip is not updated in security releases. On a CPython without the SPKI block, every new venv therefore starts with the old bundle.
Container images. On October 21, the official Python images still contained the old pip. For 3.13 to 3.15 this has since been fixed; for 3.11 and 3.12 no new pip is coming (docker-library/python 2026). These two images are now on 3.11.18 and 3.12.16 and therefore have the SPKI block (docker-library/official-images 2026). An image built before these releases stays vulnerable until it is rebuilt. A rebuild from the layer cache does not change that.
Lockfiles and cooldowns. Pinning dependencies and adopting new versions only after a few days protects you against compromised releases. In the same thread, Henry Schreiner points out that with cooldowns you stay vulnerable until you update. Both goals are legitimate, and you need a way to route a security update past the waiting period on purpose.
4. What this means for agents
This section is my own conclusion. The primary sources do not mention AI agents.
An agent or MCP server written in Python opens many outbound HTTPS connections: to the model provider, with the API key in the Authorization header, to tools, and to web pages whose content ends up in the context. Such services often run in long-lived containers with a fixed lockfile and a fixed base image. An attacker in the network path can use a certificate from a trusted but compromised chain to read the key or alter tool results, which means writing instructions into the context. This requires a position in the network, for example a compromised proxy, manipulated DNS or another system in the same network segment. It is not an attack that works across the whole internet.
5. Checking which bundle a process trusts
The following script prints, for the running interpreter, which certificate paths the ssl module uses, which certifi versions are installed and embedded in pip, and whether the Python version has the SPKI block. It only needs the standard library and exits with code 1 if there is a warning. That makes it usable in an image build or in CI.
import importlib.metadata as md
import importlib.util
import os
import re
import ssl
import sys
MIN_CERTIFI = (2026, 10, 19)
MIN_PIP = (26, 2, 2)
# First CPython releases per branch with the SPKI block (gh-160040).
SPKI_BLOCK = {(3, 15): 2, (3, 14): 10, (3, 13): 18, (3, 12): 16, (3, 11): 18}
ENV_VARS = ["SSL_CERT_FILE", "SSL_CERT_DIR", "REQUESTS_CA_BUNDLE",
"CURL_CA_BUNDLE", "PIP_CERT"]
def vtuple(v):
# Release part only; "26.2.2rc1" counts as 26.2.2.
m = re.match(r"\d+(?:\.\d+)*", v)
return tuple(int(x) for x in m.group(0).split(".")[:3]) if m else (0,)
def dist_version(name):
try:
return md.version(name)
except md.PackageNotFoundError:
return None
def pip_vendored_certifi():
spec = importlib.util.find_spec("pip")
if spec is None or spec.origin is None:
return None
path = os.path.join(os.path.dirname(spec.origin), "_vendor", "certifi", "__init__.py")
try:
with open(path, encoding="utf-8") as f:
m = re.search(r'__version__\s*=\s*"([^"]+)"', f.read())
except OSError:
return None
return m.group(1) if m else None
def main():
warnings = []
print("Python: ", sys.version.split()[0], sys.executable)
print("OpenSSL: ", ssl.OPENSSL_VERSION)
paths = ssl.get_default_verify_paths()
print("ssl/urllib cafile:", paths.cafile, "| capath:", paths.capath)
for var in ENV_VARS:
if os.environ.get(var):
print(f"env {var} = {os.environ[var]}")
py = sys.version_info
patch = SPKI_BLOCK.get((py.major, py.minor))
if patch is None and (py.major, py.minor) < min(SPKI_BLOCK):
warnings.append("Python branch without security releases, no SPKI block")
elif patch is not None and py.micro < patch:
warnings.append(f"SPKI block only from {py.major}.{py.minor}.{patch}")
certifi = dist_version("certifi")
print("certifi: ", certifi or "not installed")
if certifi and vtuple(certifi) < MIN_CERTIFI:
warnings.append("certifi older than 2026.10.19")
pip = dist_version("pip")
vendored = pip_vendored_certifi()
print("pip: ", pip or "not installed", "| embedded certifi:", vendored or "-")
if vendored and vtuple(vendored) < MIN_CERTIFI:
warnings.append("pip with embedded certifi older than 2026.10.19")
elif not vendored and pip and vtuple(pip) < MIN_PIP:
warnings.append("pip older than 26.2.2")
for w in warnings:
print("WARNING:", w)
return 1 if warnings else 0
if __name__ == "__main__":
sys.exit(main())
On my machine, for a Python 3.14.0 with pip 25.2, it reports two warnings: no SPKI block, and a pip with embedded certifi from July 2025. The pip warning also appears on an interpreter with the SPKI block, for example in the official images for 3.11 and 3.12, and makes the CI step fail there until pip is updated. The script only checks the interpreter it runs in. It therefore has to run in every venv and every image, which a single run on a laptop does not cover. It does not cover uv and other tools with their own bundle.
6. What I recommend to teams
Update the interpreter. The most important lever is CPython at the October 25 level or newer, because the SPKI block then applies to all connections through the ssl module, independent of the bundle. Where that is not possible, bring pip to at least 26.2.2 and certifi to at least 2026.10.19 in every existing venv, installing the pip wheel via URL and hash as described in the thread. Update uv with UV_SYSTEM_CERTS=true uv self update, so the download does not go through the old embedded bundle. This assumes an up-to-date system store and applies to the standalone installer; otherwise uv is updated via pip, pipx or Homebrew. Rebuild images without the layer cache.
Consider the system store as an option. The truststore package lets Python use the operating system’s certificate store, on macOS and Windows with the platform’s verification. The advantage: a single update of the system certificates takes effect for all processes. The drawback shows up in containers. There, the system bundle is as old as the image, and the problem moves from the Python package to the base image. I would therefore only choose the system store if images are rebuilt regularly.
Check bundle freshness as part of the supply chain. Minimum versions for certifi and pip belong in the constraints, and the script above, or your own variant, runs as a step in the image build. Vulnerability scanners help in addition, but I would check whether they report advisories without a CVE. OSV lists the certifi advisory, so scanners based on that data should know about it. Cooldown rules need a documented exception for security updates.
Restrict agents’ outbound connections. An egress proxy with an allowlist defines which hosts an agent may connect to at all. If the proxy terminates TLS itself, the trust decision sits in one place that a team updates centrally. This is a larger change and pays off mainly for agents with tools and web access.
7. Conclusion
For Python teams, the eMudhra case ended without known abuse. It showed how long trust in a compromised certificate authority lives on in a Python stack: in the certifi package, in pip’s copy, in uv’s bundle, in every venv and in every image that is not rebuilt. The block in the ssl module appeared eight days after the report, and the bundle updates before it had to reach every environment one by one. If you know which bundle lives where in your stack, you can update as soon as the fixes appear the next time, instead of searching your stack first.
What I check here
I check which processes in a system open outbound TLS connections and which bundle they trust when doing so: certifi, an embedded copy, the system store or a custom path set through environment variables. Then I look at how a security update of these bundles and of the interpreter reaches images, venvs and lockfiles, whether cooldown rules have an exception, and whether there are places with CERT_NONE or disabled verification. For agents, this includes which hosts they may reach and by which route.
Sources
- astral-sh/uv (2026): Release 0.13.5. https://newreleases.io/project/github/astral-sh/uv/release/0.13.5
- certifi (2026): Removal of emSign root cerificate [sic]. https://github.com/certifi/python-certifi/security/advisories/GHSA-6q48-6c7w-9gw2
- CVE Program (2026): CVE-2026-115557: Distrust compromised intermediate certificates in ssl module. https://www.cve.org/CVERecord?id=CVE-2026-115557
- docker-library/official-images (2026): library/python. https://github.com/docker-library/official-images/blob/master/library/python
- docker-library/python (2026): These images ship vulnerable pip. https://github.com/docker-library/python/issues/1142
- GitHub Advisory Database (2026a): certifi bundles emSign root CAs with compromised intermediate CA keys. https://github.com/advisories/GHSA-6q48-6c7w-9gw2
- GitHub Advisory Database (2026b): uv’s bundled CA store trusts an emSign root whose intermediate CA keys are compromised. https://github.com/advisories/GHSA-hq85-5cpj-mr62
- Heimes, C. (2026): ssl: distrust compromised eMudhra intermediate CA keys. https://github.com/python/cpython/issues/160040
- Larson, S. M. (2026): Information for Python users regarding eMudhra / emSign CA certificate security incident. https://discuss.python.org/t/information-for-python-users-regarding-emudhra-emsign-ca-certificate-security-incident/109576
- Mozilla Bugzilla (2026): eMudhra: Private key compromise of Intermediate Certificates. https://bugzilla.mozilla.org/show_bug.cgi?id=2083449
- pypa/pip (2026a): Switch to using truststore only by default (currently mixed certifi + truststore). https://github.com/pypa/pip/issues/14374
- pypa/pip (2026b): NEWS.rst. https://github.com/pypa/pip/blob/main/NEWS.rst
- pypa/pip (2026c): HTTPS Certificates. https://pip.pypa.io/en/latest/topics/https-certificates/
- Python Software Foundation (2026): Python Release Python 3.12.16. https://www.python.org/downloads/release/python-31216/
- Wayne (2026): eMudhra Intermediate CA Compromise. https://emudhra.we-have-a-problem.com