r/Python • u/sethmlarson_ Python Software Foundation Staff • 6d ago
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
7
u/HeartfireFlamewings 6d ago edited 6d ago
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 6d ago
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 6d ago
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 5d ago
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 5d ago
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 21h 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 2h 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 6d ago
How to.avoid such issue in production setup, can u guide !? I want to learn
0
6d ago
[deleted]
11
u/sethmlarson_ Python Software Foundation Staff 5d ago
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 5d ago
Does it make more sense to get truststore (or something similar) into the standard library?
1
u/shinitakunai 4d ago
Probably yes. The windows ecosystem of python is huge, as it is so accesible for people learning
13
u/zurtex 5d ago
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.
43
u/AlSweigart Author of "Automate the Boring Stuff" 6d ago
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.