[ DOTSTAR_SYSTEMS ]

blog article

eMudhra's CA Private Key Was 4: What Happened, Root Cause, and the Checks That Would Have Caught It

Eight publicly trusted eMudhra intermediate CAs had private keys smaller than 256. One of them was literally 4. A short engineering read of what happened, eMudhra's own root-cause account, and the cheap checks in a key ceremony, and in any factory provisioning line, that would have stopped it.

eMudhra's CA Private Key Was 4: What Happened, Root Cause, and the Checks That Would Have Caught It

TL;DR: Eight eMudhra intermediate CAs, six for TLS and two for code signing, trusted by Chrome, Firefox, Apple and Microsoft, had P-384 private keys whose value was below 256. One was 4. Nothing was stolen, and the cryptography and the HSM were fine. It was human error in the key ceremony, eMudhra’s own words: a modified script created a second, weak key pair on the HSM, and someone picked it for the CSR “because the key labels were similar.” Nobody checked the output, so for 18 months anyone could recover the keys from the public certificates by computing 1·G, 2·G, … 255·G and comparing. Got EC keys of your own? There’s a one-line check below.

Update (21 October 2026): The original reporter says he found this by running Google’s open-source paranoid_crypto over the CCADB, the shared database of publicly trusted CA certificates. It flagged eMudhra out of the box. He meant it as a quick test before looking at subscriber certificates. In his words: “Most of my time has been spent going over the basics that everyone assumed someone else had already done.” A free tool would have caught this in one run at any point in the last 18 months.

Correction (10 November 2026): eMudhra has revised its root cause. Nobody picked the weak key by hand because of similar labels. The ceremony script itself created the CSRs from the re-imported keys, and a CRL signature failure in June 2025 pointed at the mismatch 16 months before the disclosure. Details, and how far the fix has reached devices, are in our follow-up.

The internet has had a great week with this one. “Chosen by fair dice roll, guaranteed to be random” is doing a lot of work on social media right now, and honestly, fair enough. But the failure itself is mundane, and that’s why it’s worth five minutes: the same shape of bug sits in plenty of key-generation and device-provisioning pipelines that nobody is looking at.

What happened

  • 30 April 2025. eMudhra runs a key ceremony and creates the G3B and G3C series of ECC intermediates: DV, OV, EV TLS and OV code signing, two of each. Sectigo cross-signs them in May.
  • 17 October 2026, 18:05 UTC. A researcher reports to the root programs that the private keys are recoverable, and proves it by signing “We have a problem here” with each of the eight keys. Chrome pushes a CRLSet block within two hours. Firefox’s OneCRL follows the same evening.
  • 18–19 October. eMudhra revokes the eight intermediates. Sectigo revokes its cross-signs. Apple and Microsoft block.
  • 20 October onward. Mozilla requests emergency removal of trust in emSign ECC Root CA – G3. Chrome removes it from the Chrome Root Store with the 27 October release. Go ships 1.27.3/1.26.10 rejecting the keys. eMudhra stops issuing under that root, and in the Mozilla incident bug estimates roughly 30,000 certificates to migrate to its RSA hierarchy.

No misuse has been reported. Chrome found no TLS certificates chaining to the six TLS intermediates in Certificate Transparency logs before the block, so CT-enforcing browsers were safe. The exposure is everything that doesn’t enforce CT: most non-browser TLS clients, IoT devices, anything that verifies Authenticode-style signatures against the two code-signing intermediates. For roughly 18 months, anyone who looked could have minted certificates or signed code under a publicly trusted name.

How bad is “smaller than 256”

A P-384 private key is a random integer d in [1, n−1] with n ≈ 2³⁸⁴. The public key is Q = d·G. Recovering d from Q is the discrete-log problem, which is what makes the curve safe. If d < 256, there is no problem to solve. You walk G, 2G, 3G, … until you hit Q. That’s 255 point additions. Scott Helme recovered all eight on a laptop in under a second. Mozilla noted that local AI agents recovered them on the first try when told it was a CTF.

Mozilla’s description of the keys is the clue to the bug: “effectively all-zeroes apart from the last byte.” That is not a weak random number generator. A weak RNG gives you keys with low entropy that still look like 384-bit numbers. This is 47 zero bytes and one byte of something, which looks much more like a buffer that was never filled, a counter or a test value written into a 48-byte field. eMudhra hasn’t published the script, so that’s our reading, not a confirmed fact.

Root cause, per eMudhra

From eMudhra’s comments in the Mozilla incident bug:

  1. Keys were generated in Utimaco HSMs (FIPS 140-2 Level 3). eMudhra says the device does not appear to be at fault.
  2. The ECC keys were created on the HSM as normal.
  3. An approved deviation to the standard ceremony script was added to test key wrap/unwrap, because these intermediates were meant to be exported to US and European data centres for data-sovereignty reasons.
  4. A flaw in that code created a second, weaker key pair on the HSM.
  5. The weak pair was used by mistake to create the CSR, because the key labels were similar.
  6. Those CSRs went to Sectigo for cross-signing too.

eMudhra’s own summary: “There were human errors in multiple steps of the process.” So the RCA is not “bad crypto”. It’s three ordinary engineering failures stacked up:

  • Test code ran in a production ceremony. A wrap/unwrap experiment belongs on a lab partition, not in the session that creates long-lived trust anchors.
  • Keys were selected by a human-readable label. Two objects with near-identical labels and nothing stopping the wrong one being used.
  • Nobody checked the artefact. The ceremony was a scripted process that was followed. Nobody verified the output, a public key with 383 leading zero bits, with even the simplest test.

What would have caught it

None of this needs new cryptography. Each of these is a few lines of script. Checks 1 and 2 would each have stopped this on their own. The rest make the whole class of bug rarer.

1. Small-scalar check on every public key you sign. Precompute k·G for k up to, say, 2²⁰ (a few megabytes, built once) and reject any Q that’s in the table. Add the usual siblings: the Debian-weak-key style blocklists, ROCA for RSA, duplicate-key detection across your own inventory. This belongs in the CA’s CSR intake and in the cross-signer’s. Sectigo signed these CSRs too, so a check on either side would have stopped them.

2. Select keys by fingerprint, not label. At generation, record the SHA-256 of the public key (SPKI) in the ceremony log. The CSR step takes that hash as input and refuses unless the key it’s about to use matches. Labels are for humans to read, not for picking which key gets used.

3. Check the key’s provenance attributes on the HSM. In PKCS#11, a key generated on the token has CKA_LOCAL = true. One that came in by C_UnwrapKey or C_CreateObject does not. For a CA signing key, the script should assert CKA_LOCAL, CKA_SENSITIVE, !CKA_EXTRACTABLE (unless export is the point) and the expected curve before it signs anything. If the weak pair came from a test unwrap path, which is what “wrap/unwrap test” suggests, this check catches it.

4. Treat the ceremony script as production code. Code review, a dry run against a non-production HSM partition with the exact same script, and diffable output. An “approved deviation” should mean the deviation itself was tested before the ceremony, not just signed off. The witnesses and auditors watching a ceremony check the process. Someone has to check the output too.

5. A pairwise consistency test you actually look at. Sign and verify with the new key, then compare the public key in the CSR with the one logged at generation (check 2). FIPS modules do a pairwise test internally on generation, but a key with d = 4 passes it. A consistency test proves the pair matches, not that it’s any good. You need check 1 as well.

Check your own keys

For a single certificate, this one-liner tries every private key from 1 to 4095 (pip install cryptography):

python3 -c 'import sys;from cryptography import x509;from cryptography.hazmat.primitives.asymmetric import ec;q=x509.load_pem_x509_certificate(open(sys.argv[1],"rb").read()).public_key();print("skip: not an EC key" if not isinstance(q,ec.EllipticCurvePublicKey) else next((f"WEAK: d = {k}" for k in range(1,1<<12) if ec.derive_private_key(k,q.curve).public_key()==q),"ok: d > 4095"))' cert.pem

Run it on eMudhra’s EM OV TLS CA - G3C and it prints WEAK: d = 4. This flaw only exists for elliptic-curve keys, so an RSA certificate prints skip: not an EC key.

For anything bigger, use our script, ec-small-key-check.py. It reads certificates, CSRs and public keys (many per PEM file) on P-256, P-384 and P-521. It walks k·G once per curve with plain point additions and checks every key at the same time, so a whole CA bundle or a provisioning batch costs about the same as one key. It also catches d = n − k.

python3 ec-small-key-check.py --max 1000000 *.pem   # exit 1 if any key is weak

On the 16 published eMudhra certificates (eight keys, each in an eMudhra- and a Sectigo-issued cert) it finds all eight keys in under 0.1 s, and the values match Scott Helme’s. On the 39 EC roots in Ubuntu’s system CA bundle it finds nothing. The exit code makes it easy to drop into a CSR intake or a provisioning line as a gate.

For a wider audit, use Google’s paranoid_crypto. Its CheckWeakECPrivateKey is the check that found this bug, and it covers many RSA and ECDSA weaknesses as well. For known-bad key blocklists, use badkeys. Our script does one thing: it’s a single file you can drop into a pipeline as a gate.

Why this matters if you don’t run a CA

Swap “intermediate CA” for “device identity key” and this is a factory provisioning line. Scripts that generate or inject per-device keys and certificates into secure elements, TF-M/PSA key storage or an nRF KMU. The same three failures show up there: a debug or test path left in the production script, keys picked by slot number or label instead of fingerprint, and nobody checks the public keys that come off the line. In a provisioning line, a constant or near-constant key is a fleet-wide break, and there’s no CRLSet to push to a million sensors.

The cheap fix is the same: run every public key coming off the line through a duplicate and small-scalar check before it’s signed or registered. It costs milliseconds per device.

Where Dotstar fits

We work on the device side of this: PSA Crypto key lifecycles, secure provisioning flows, and the scripts around them. If you’d like someone to read your key-generation and provisioning pipeline with “could our key be 4?” in mind, that’s a Technical Audit: five days, fixed fee, written findings. If the checks above need building into your line, that’s an Engineering Sprint.

Talk to us about a provisioning audit

Sources

Original post on LinkedIn →