Thursday, December 3. 2026
How I almost found the eMudhra d=4 Private Key
The issue itself is easy to understand. The affected keys use the ECDSA algorithm, a commonly used signature algorithm based on elliptic curves, with the curve p384r1. We do not need to understand anything about elliptic curves to understand this vulnerability. It is sufficient to understand that an ECDSA private key is simply an integer number that we call d. Usually it's a large number. The affected eMudhra keys, however, were small, one of them was simply "4", the others were all small enough to fit into a single byte.
I am developing a tool named badkeys that identifies insecure cryptographic public keys. Finding security incidents like this one is, pretty much, exactly what badkeys is supposed to do. However, badkeys has not found this vulnerability, although, arguably, it was close. I want to share that backstory here.
In November 2025, eleven months before the eMudhra incident was discovered, Theo Buehler created a bug report in the badkeys issue tracker titled: "Are elliptic curve keys corresponding to small private keys bad keys?" It proposed to do the exact thing that would have found the eMudhra vulnerability: check for elliptic curve keys with small private key values.
I thought that this was a valid request. The idea that, accidentally, someone might create a key from a very small value sounded plausible. My experience is that if you can plausibly imagine a security flaw in public key cryptography, you will usually be able to find the flaw in the wild if you search long enough.
badkeys uses various approaches to identify different security vulnerabilities. In many cases, known-compromised keys are simply part of a large blocklist of hashes. The blocklist is, e.g., used to identify keys affected by the "famous" Debian OpenSSL bug. Other vulnerabilities are detected algorithmically. For example, RSA keys with primes that are close to each other can be detected and broken with the Fermat factorization method, which is easy to implement and very fast.
The simplest way to detect elliptic curve keys with small private values would have been to add them to the blocklist. This would require some decisions, e.g., which values and which curves to cover (there exists a large number of obscure elliptic curves as a result of NIH syndrome and crypto-nationalism). I had already created a script that would create keys for values up to 16 for the most common curves. Which means I already had one of the affected private keys stored on my laptop.
I also already had a collection of "interesting" keys that I scan regularly with badkeys. Those included all certificates included in CCADB, a public database with information about certificate authorities, including all currently used root and intermediate certificates. If I had added the keys from my preliminary script to the badkeys blocklist, a cronjob would have found the d=4 key.
However, I wondered whether there was a more elegant way to identify these keys using algorithmic detection, possibly allowing to detect a large number of "small" private keys without growing the blocklist. In December 2025, during 39C3, I talked to Nadia Henninger, who is an expert on attacking public keys. Nadia suggested that an algorithm known as Pollard's Lambda or Pollard's Kangaroo might be the best approach. Alternatively, the Baby Step Giant Step algorithm would also be an option.
During that same conversation, Nadia also introduced me to Keegan Ryan, and he had an idea about RSA keys (looking at the ratio of 0 vs. 1 bits in the public modulus) that would lead to the discovery of a new class of vulnerable RSA keys with repeating zero patterns that can be factored efficiently.
Using Pollard's Kangaroo sounded good. However, the algorithm was a tad bit too complicated to be implemented quickly, and I hadn't found an existing implementation that could be adapted and integrated into badkeys easily. Also, most of my work on badkeys in the following months was on the RSA findings.
There's a side story here. While investigating that RSA vulnerability, we discovered that many of the affected vulnerable keys were generated by a software called CompleteFTP. Naturally, I downloaded a trial version of CompleteFTP and looked at the generated keys. They did not look like the insecure keys we had seen, but they looked odd nonetheless. The RSA keys had a large public exponent. This is quite unusual, as the RSA public exponent is usually a small number, and, these days, almost always set to a standard value of e=65537. When I saw that unusually large public exponent, I immediately suspected that there might simply be a confusion between private and public key values. (The RSA formulas still work if you swap private and public exponent.)
A quick check confirmed it: CompleteFTP on Linux created keys with the private exponent d=65537.
There's a generic algorithm to break small private d RSA keys called Wiener's attack, and I subsequently added it as a check in badkeys. There surely is some irony in the fact that I went out to look for a way to implement a check for ECDSA keys with small d values, and ended up finding RSA keys with small private d values and implemented a check for them first.
When wondering about those small private d ECDSA keys, an obvious question one might ask is if such keys have been discovered anywhere else. As far as I am aware, plenty of people have looked for them since the eMudhra incident became known, but no one has reported any other production keys yet. However, elliptic curve keys with small values have been occasionally used in test suites. The source code of Google's boringssl contains test vectors with keys in JSON Web Key format with some such example keys, including ECDSA p384 keys with d=2 and d=3. That's, obviously, quite close to d=4.
The badkeys blocklist includes many example keys, including these boringssl test keys. These example keys use ECDH instead of ECDSA, but badkeys treats those identically. It was another instance where badkeys was very close to finding the eMudhra keys.
How the weak eMudhra keys were actually found
While badkeys was close to finding the eMudhra keys, eventually, they were found with a different tool. Nevertheless, badkeys played a role in its discovery.
On October 17th, 2026, I was contacted by someone who called himself Wayne. He, apparently, had audited badkeys (likely with the help of AI tools) and reported a couple of issues. While of low severity, the reports were legitimate and valuable. (They are all fixed now.)
In a follow-up mail, Wayne implied that a major WebPKI issue was about to be disclosed and that I should keep my ears open. I heard more rumors on Monday (October 19th), and after I started looking into it, I discovered that Chrome's CRLSet revocation system had blocked keys belonging to eMudhra intermediates. From there, it didn't take long to figure out what the bug was and I learned about the d=4 key. It was only hours later that rumors spread and the issue was revealed publicly.
My suspicion was that Wayne had seen the badkeys bug report suggesting to scan for small elliptic curve keys. But, according to his account, that was not the case.
Back in 2022 when I started developing badkeys, I noticed some odd things. I discovered, for example, multiple certificates with different kinds of compromised or weak keys that were already revoked. I got the feeling that someone else was working on something very similar. Little did I know at the time that the other person was none other than Daniel Bleichenbacher, widely considered to be one of the most skilled cryptographers. His most well-known achievement is an attack against RSA encryption published in 1998. (One of my own contributions was to discover that Bleichenbacher's attack from 1998 still worked very well against many web sites in 2017.)
In 2022, Daniel Bleichenbacher worked for Google and, together with Pedro Barbosa, developed a tool called paranoid_crypto that has a lot of overlap with what badkeys is trying to do. Its scope is broader, it analyzes not just public keys, but also other cryptographic artifacts like signatures, and checks them for known vulnerabilities.
I don't remember exactly when I first saw it, but when I learned about it, I checked whether it included any features that badkeys should adopt. However, I missed that it includes some checks for elliptic curve keys that, in retrospect, certainly would have been a valuable addition to badkeys. Notably, it includes an implementation of the Baby Step Giant Step algorithm that detects elliptic curve keys with small private key values. My retroactive explanation for failing to see this is that those checks were not prominently featured in the paranoid_crypto README. It includes a list of successful checks that discovered weak keys in the wild. Most checks in that list overlap with functionality badkeys already has. I guess that was another time when badkeys almost got a feature that could've found the eMudhra incident.
In August 2026, Alexander Tereschenko opened an issue in the badkeys issue tracker asking about paranoid_crypto. My reply was similar to what I wrote above: that the scope of paranoid_crypto is broader, but that I believe all interesting checks for public keys are already implemented in similar ways in badkeys. It was this issue that Wayne saw and that let him try paranoid_crypto. One of the first things he did was to check certificates from CCADB with paranoid_crypto. It immediately found the eMudhra certificates. Wayne subsequently reported them to the browser root programs.
Epilogue
Immediately after the eMudhra incident became public, I added a bunch of small d elliptic curve keys (all 1 byte values for the common curves) to the badkeys blocklist. I may replace that later with an implementation of the Baby Step Giant Step algorithm, which, after learning a bit more about the issue and after some tests, seems like the most efficient way to detect these keys.
I shared a draft of this post with a few people in advance. I got the feedback that I shouldn't beat myself up about it. That is not my intention. Figuring out in hindsight what one could have done is always easy, and there is no way I could have known how close I was to discovering a major security flaw. I just thought this is an interesting story to share.
If you think a project like badkeys should be supported, check its "Funding" page.
Image source: Ptkfgs/Wikimedia Commons, Public Domain
Posted by Hanno Böck
in Cryptography, English, Security
at
22:21
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: badkeys, certificates, crypto, cryptography, ecdsa, emudhra, webpki, x509
Related entries by tags:
- Private Keys in the Fortigate Leak
- The Problem with OCSP Stapling and Must Staple and why Certificate Revocation is still broken
- Slides from cryptography workshop for web developers
- Incomplete Certificate Chains and Transvalid Certificates
- How to configure your HTTPS server
- X.509 / SSL certificate test cases
- Mixing up Public and Private Keys in OpenID Connect deployments
- How to create a Secure, Random Password with JavaScript
- Security Issues with PGP Signatures and Linux Package Management
- How I tricked Symantec with a Fake Private Key
Trackbacks
Trackback specific URI for this entry
No Trackbacks