Repository navigation
gh-160040: Distrust compromised eMudhra intermediate CA keys #160042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tiran
wants to merge
7
commits into
python:main
Choose a base branch
from
tiran:ssl-distrust-emudhra-keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+340
−4
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6275d65
gh-160040: Distrust compromised eMudhra intermediate CA keys
tiran 4ff0516
gh-160040: Fix c-analyzer check and add What's New entry
tiran 462e69e
gh-160040: Add tests for distrusted eMudhra intermediate CA keys
tiran eb71f14
gh-160040: Match distrusted SPKI by SHA-256 digest
tiran 77bf8b0
gh-160040: Refine distrusted SPKI check, docs, and test cert generation
tiran 641c999
gh-160040: Store distrusted test certs in an encrypted zip
tiran 42a0b3e
Merge remote-tracking branch 'upstream/main' into ssl-distrust-emudhr…
tiran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Misc/NEWS.d/next/Security/2026-10-21-16-55-07.gh-issue-160040.9PjFjC.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| :mod:`ssl` now rejects TLS certificate chains that contain any of a set of | ||
|
sethmlarson marked this conversation as resolved.
|
||
| compromised eMudhra intermediate CA keys. This is an extraordinary measure and | ||
| a last line of defense: removing trust is primarily the job of the platform root | ||
| store, and the built-in denylist only blocks connections while that update has | ||
| not yet reached the OS, a container image, or a bundled trust store in various | ||
| Python packages. Entries are added to the denylist only under a very high | ||
| threshold. | ||
| The denylist matches on the public key (the SHA-256 digest of the :rfc:`5280` | ||
| ``SubjectPublicKeyInfo``), so it also covers the cross-signed certificates that | ||
| reuse one of the distrusted keys. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* Denylist of distrusted SubjectPublicKeyInfo (SPKI). | ||
| * | ||
| * Verification rejects any chain with a cert whose SPKI SHA-256 digest is in | ||
| * the _distrusted_spki table. We match the key, not a cert fingerprint, so | ||
| * cross-signs that reuse the key are blocked too. | ||
| * | ||
| * This is an extraordinary measure and last line of defense. Removing trust is | ||
| * primarily the job of the platform root store. This list only blocks keys while | ||
| * that update is still propagating to the OS, container images, or root CAs | ||
| * bundled in Python packages. The threshold for adding an entry is very high. | ||
| * | ||
| * See https://github.com/python/cpython/issues/160040 for the eMudhra discussion. | ||
| * | ||
| * To block another key, add the SHA-256 digest bytes of its SPKI: | ||
| * | ||
| * $ openssl x509 -in cert.pem -noout -pubkey | openssl pkey -pubin -outform DER | openssl dgst -sha256 -binary | xxd -i | ||
| */ | ||
| #ifndef Py_SSL_DISTRUSTED_SPKI_H | ||
| #define Py_SSL_DISTRUSTED_SPKI_H | ||
|
|
||
| #include "openssl/sha.h" | ||
|
|
||
| static const unsigned char _distrusted_spki[][SHA256_DIGEST_LENGTH] = { | ||
| /* Compromised eMudhra intermediates, https://emudhra.we-have-a-problem.com/ */ | ||
| /* CN=EM OV TLS CA - G3B,O=eMudhra BV,C=NL */ | ||
| { | ||
| 0x43, 0xbf, 0xfa, 0x19, 0xd6, 0xef, 0x65, 0x14, 0x51, 0xf6, 0x84, 0x1e, | ||
| 0x01, 0x99, 0x31, 0xe9, 0x6f, 0x6f, 0x2e, 0xae, 0xff, 0x28, 0xab, 0x4b, | ||
| 0x6f, 0x1c, 0xe4, 0x57, 0x6d, 0xe2, 0x71, 0x7b, | ||
| }, | ||
| /* CN=EM DV TLS CA - G3C,O=eMudhra Inc,C=US */ | ||
| { | ||
| 0x49, 0xdd, 0x35, 0x3d, 0xc2, 0xb9, 0x19, 0xa3, 0x77, 0x06, 0x45, 0x11, | ||
| 0x7d, 0x0e, 0x60, 0xc1, 0x61, 0x15, 0xe7, 0xd1, 0xbc, 0x25, 0x9e, 0xef, | ||
| 0xe7, 0x34, 0xb0, 0x0e, 0xa4, 0x34, 0xfe, 0x5f, | ||
| }, | ||
| /* CN=EM EV TLS CA - G3C,O=eMudhra Inc,C=US */ | ||
| { | ||
| 0x5c, 0x06, 0x60, 0xa2, 0xb1, 0x64, 0x91, 0x0d, 0x8f, 0xf5, 0x89, 0xc1, | ||
| 0x8e, 0x14, 0x55, 0x2e, 0x9e, 0x0e, 0xc2, 0x37, 0xdc, 0xef, 0xe2, 0xcb, | ||
| 0x73, 0x6d, 0x41, 0xa4, 0x81, 0x1f, 0x81, 0xa0, | ||
| }, | ||
| /* CN=EM OV TLS CA - G3C,O=eMudhra Inc,C=US */ | ||
| { | ||
| 0x63, 0xec, 0xef, 0xee, 0x43, 0x1d, 0x49, 0x52, 0x3b, 0xc1, 0x13, 0x6c, | ||
| 0x4e, 0x72, 0xd0, 0x20, 0x6a, 0x47, 0x70, 0x86, 0xca, 0xf6, 0x06, 0xcd, | ||
| 0x5c, 0xf0, 0x25, 0x68, 0x6c, 0x10, 0x9c, 0xf8, | ||
| }, | ||
| /* CN=EM OV CS CA - G3C,O=eMudhra Inc,C=US */ | ||
| { | ||
| 0x92, 0xc0, 0x63, 0xd6, 0x7e, 0x8f, 0x14, 0xdb, 0x71, 0xd2, 0x88, 0xe1, | ||
| 0x12, 0x66, 0xff, 0xda, 0xf6, 0x9c, 0xbf, 0x11, 0x5f, 0x7b, 0xab, 0x14, | ||
| 0xf3, 0xbc, 0x2f, 0x68, 0xd2, 0x5e, 0x0e, 0x30, | ||
| }, | ||
| /* CN=EM EV TLS CA - G3B,O=eMudhra BV,C=NL */ | ||
| { | ||
| 0xe0, 0x25, 0x4c, 0x7f, 0xcd, 0xc2, 0x65, 0xe2, 0xf0, 0xf8, 0xa4, 0x28, | ||
| 0xda, 0xbb, 0x75, 0xab, 0x4a, 0xe0, 0x39, 0xb4, 0x87, 0x2d, 0x62, 0xf5, | ||
| 0xee, 0x57, 0xf0, 0x87, 0x7d, 0x5a, 0x8a, 0x41, | ||
| }, | ||
| /* CN=EM DV TLS CA - G3B,O=eMudhra BV,C=NL */ | ||
| { | ||
| 0xeb, 0xed, 0x64, 0x75, 0xc2, 0xc2, 0xd8, 0x0f, 0xcb, 0x19, 0x9f, 0x3f, | ||
| 0xe8, 0xdd, 0x6e, 0x6b, 0x3c, 0xe6, 0x0b, 0x77, 0xeb, 0x15, 0xd4, 0xe4, | ||
| 0x2c, 0x3d, 0xec, 0x0c, 0x6f, 0x5b, 0x51, 0x05, | ||
| }, | ||
| /* CN=EM OV CS CA - G3B,O=eMudhra BV,C=NL */ | ||
| { | ||
| 0xec, 0x4f, 0xfa, 0x1a, 0xd0, 0xac, 0x88, 0x08, 0x13, 0x14, 0xb7, 0xaa, | ||
| 0xff, 0xef, 0x6a, 0x91, 0xf9, 0x7c, 0xd5, 0x72, 0x91, 0xbb, 0x5b, 0xa6, | ||
| 0x86, 0xc5, 0x41, 0x5f, 0x5e, 0xb4, 0xf6, 0xb6, | ||
| }, | ||
| }; | ||
|
|
||
| #endif /* !Py_SSL_DISTRUSTED_SPKI_H */ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting the change in What's New document makes it harder to backport to other branches. Would it be enough to document it as a Changelog entry instead?
If we keep it in What's New, it should be moved to special sections in old What's New documents (when the change will be backported), such as https://docs.python.org/dev/whatsnew/3.14.html#notable-changes-in-3-14-5.