r/Python • u/sethmlarson_ Python Software Foundation Staff • Oct 20 '26
News Info for Python users regarding eMudhra / emSign CA certificate security incident
A security incident affecting eMudhra intermediate certificates has required removing the emSign root CA certificate from CA bundles such as βcertifiβ. Itβs important to immediately upgrade the software packages below to at least the versions specified and rebuild container images to fetch the latest system certificates. Failure to do so could result in monster-in-the-middle (MITM) attacks against TLS clients, including python.org and pypi.org .
(1): Advisory mentions 2026.10.18, but 2026.10.19 is recommended for compatibility with unaffected emSign root certificates.
For all existing virtual environments on your system, please upgrade pip and uv to the latest versions.
Please read the full post on discuss.python.org for up-to-date information: https://discuss.python.org/t/information-for-python-users-regarding-emudhra-emsign-ca-certificate-security-incident/109576
11
7
u/HeartfireFlamewings Oct 20 '26 edited Oct 20 '26
Correct me if i'm wrong, but creating virtual environments first installs 26.2.1 but can be upgraded with a --upgrade-deps flag, but this uses the vulnerable version to upgrade to one that is safe.
That seems a bit backwards, no?
10
u/nathan12343 Oct 20 '26
A security fix for CPython is coming:Β https://discuss.python.org/t/information-for-python-users-regarding-emudhra-emsign-ca-certificate-security-incident/109576/7
8
u/ResidentPomegranate6 Oct 20 '26
system python upgrade won't touch venvs, each carries its own certifi. rebuild images with --no-cache or the old wheel sticks in a cached layer.
3
u/__peg_parser__ Pythonista Oct 22 '26
I have many virtual envs, and it would be a pain to find each one, activate it, and update all those packages. There was a script provided in the discussion, but it's in bash, and only upgrades pip. Is there some official script that automates all this?
1
u/Boring-Meeting-17 Oct 22 '26
Anyone here succeeded in fixing the certs for the built-in /usr/bin/pip3 on macOS Tahoe? I'm following the instructions in https://emudhra.we-have-a-problem.com/#macos-curl but getting "Operation not permitted" when trying to create the "sitecustomize.py" file.
1
u/Distinct-League-474 29d ago
Did you figure it out? For me /usr/bin/python3 and pip3, the ones installed by Xcode command-line tools are still vulnerable and I cannot find a solution, Apple only discusses curl and git on their support page.
1
u/Boring-Meeting-17 28d ago
No, I think the pip that's part of Xcode can't be user-modified -- unless you turn off System Integrity Protection, I think.
OTOH, /usr/bin/python3 is fixed by the /etc/ssl/cert.pem edits. I checked by writing a little program to create an SSL connection to the test sites in the emudhra page. See https://docs.python.org/3/library/ssl.html#socket-creation
Note that the just-released Tahoe 26.7.2 overwrites /etc/ssl/cert.pem with a new version that's identical to the (insecure) 26.7.1 version, so you'll have to re-apply the fix again after the upgrade.
1
u/AcceptableAmount6028 Oct 21 '26
How to.avoid such issue in production setup, can u guide !? I want to learn
0
Oct 21 '26
[deleted]
11
u/sethmlarson_ Python Software Foundation Staff Oct 21 '26
This is a good question, I am writing down the pain points in how Python responds to this incident here:
https://sethmlarson.dev/python-cert-dist-pain-points
certifi exists because Python uses OpenSSL as a TLS implementation and OpenSSL doesn't interface with certificate store APIs for Windows and macOS, it needs either files or directories with CA certificates. Very soon pip will default to using "truststore" (a library I maintain) without using certifi. If pip starts doing this then there won't need to be any updates on Windows and macOS in case of incidents like this.
4
u/d3matt Oct 21 '26
Does it make more sense to get truststore (or something similar) into the standard library?
1
u/shinitakunai Oct 22 '26
Probably yes. The windows ecosystem of python is huge, as it is so accesible for people learning
13
u/zurtex Oct 21 '26
Pip maintainer here, to add onto what Seth has said, two main reasons:
certifi has historically been the easiest way to validate certificates in Python code, there was never good platform certificate store support
pip needs to bundle all it's dependencies because it's part of the bootstrapping chain, you can't pip install pip without a full copy of pip
I'm doing a full analysis now on what are the problems we might face switching to truststore only by default. I think we're all agreed that's the goal, but also I don't want to break users unexpectedly.
0
44
u/AlSweigart Author of "Automate the Boring Stuff" Oct 20 '26
What this means for regular folks: update your browser and update pip. You can update pip to a >= 26.2.2 version from a known good location with this command:
Posted by Seth Larson himself (PSF security engineer) on Discuss.