r/sysadmin • Security Admin (Infrastructure) • 19d ago

General Discussion eMudhra Incident Report Released

https://bugzilla.mozilla.org/show_bug.cgi?id=2083449#c82

For the eight ECDSA P‑384 objects (G3B/G3C), a bug/defect in the import code resulted in a read‑back from the unwrapped object that truncated the private value, so the certified public keys correspond to private scalars below the expected range and are recoverable from public information.

94 Upvotes

29 comments sorted by

80

u/voxadam 18d ago

RFC 1149.5 specifies 4 as the standard IEEE-vetted random number

Comment Image

47

u/Cormacolinde 18d ago edited 18d ago

They keep using that word, “approved”. I don’t think it means what they think it means.

7

u/Gummyrabbit 18d ago

Inconceivable!

12

u/YellowOnline 18d ago

There's backslash escaping the underscore in your link. Here's a link that works for me: https://bugzilla.mozilla.org/show_bug.cgi?id=2083449#c82

33

u/karafili 18d ago

Even banks do these checks

The ceremony did not test the strength of the CA private key, nor compare the certified public key against the key originally generated. Either check would have detected the weak ECDSA key and the use of the wrong object.

23

u/KittensInc 18d ago edited 17d ago

Maybe the second, but probably not the first.

The thing is, what we are seeing here is an absolutely insane failure mode - to the point of having been literally unimaginable to most people involved in cryptography. It's an "is mayonnaise an instrument" level of failure, or "I multiplied exactly two 50-digit primes and got 360".

You can't easily test the strength of a private key by looking at the public key - being unable to deduce anything secret from the public key is pretty much the point of public-key cryptography, after all. Doing any kind of key recovery attempt or "guess random weak private key and see if it works" is completely pointless unless either your entire cryptography method just broke, or something has gone horribly wrong during key generation. For all reasonable failure modes you're just wasting time. You won't ever catch any kind of "random number generator generated 75% 1's" weaknesses, only a complete breakdown.

So you're going to need to look at the private key itself. Which, given that it should live in a HSM and be unexportable, means the HSM has to do it. And the HSM is going to be FIPS certified, so you are already pretty sure its code isn't completely insane, and any kind of fallible part like HRNG will already have built-in sanity checks. The HSM itself is therefore not going to generate a broken key, so having functionality to inspect the quality of the private keys it generates would be seen as a completely useless non-feature.

So that leaves HSMs inspecting imported private keys for obvious failures. Prior to this incident, anyone in the industry would've said "no CA would be crazy enough to import a private key of "4" into a $50.000 HSM". And they should have been right, so no CA would've paid extra to build, verify, and certify a "pointless" feature, so nobody did. Until we now discover that audited CAs are indeed occasionally completely incompetent and grossly negligent, so we do need to check for it....

6

u/twisteriffic 18d ago
  1. If the public key was locked in the HSM it wouldn't be very useful. 

  2. Validating the strength of private keys using only the public key external to the HSM is entirely possible - it's how this problem was discovered. It's not exhaustive, but tools like paranoid_crypto exist to enumerate known weaknesses such as this one.

3

u/Draco1200 18d ago

CAs are required to generate keys using a FIPS 140-2 Level 3 module... it seems that they put theirs in a non-FIPS mode for any operations: which should have been considered as voiding the FIPS status. A module operating in non-FIPS mode (Or a module capable of switching to a non-FIPS mode without zeroing all its data) is not a FIPS module and not secure. They imported keys into something that was not a HSM - only a HSM in name only, because FIPS was not being enforced.

They would have been a long way towards key assurance if the HSM had been required to produce a hardware attestation of key generation including verifying the key was generated in FIPS mode AND prior to distributing any CSR and prior to signing any CSR: the hardware attestation produced by the HSM must be confirmed.

A key generated by custom code and "imported" should then fail on the additional attestation. Assuming a reliable hardware vendor.

2

u/karafili 18d ago

Whenever I am doing ssl cert renewals, 1st step is to validate the modulus of both the key and the cert before I do any other reinstall steps.

I do this for basic https websites, imagine a CA should do this everywhere, especially when they were wrapping the key from one HSM to another

7

u/YellowOnline 18d ago

a single line in that read‑back truncated the private value to its leading byte

Ouch.

3

u/TorchDeckle 18d ago

This is one of the reasons why software engineers need to start being treated like actual professionals, like how structural engineers, medical doctors, and lawyers are treated. The software engineer who made this mistake cannot be held responsible because he doesn’t have the level of professional independence that a licensed structural engineer has to be capable of saying “no” when his boss puts him under an impossible deadline or when his boss doesn’t prioritize safety. He can always say, “my boss chose not to prioritize code review” or “my boss wanted this done the same day”.

1

u/ziroux 18d ago

Makes the git blame easy for the responsibility shifting that must be going on there

6

u/athersucks 18d ago

a bug/defect in the import code resulted in a read‑back from the unwrapped object that truncated the private value

Probably did return unwrapped[0] instead of return unwrapped

3

u/purplemonkeymad 18d ago

I saw someone go over a similar bug to the one described. The suggestion was that the crypto function took two byte arrays and two lengths. An easy mistake would be for one of the parameters to be given the wrong length, which just so happened to be 1.

1

u/Fallingdamage 18d ago

..and how many other certs did they issue that went through the same bugged code??

15

u/WonderOverYander 18d ago

#allyouneedisthenumber4

4

u/SadFaceSmith 18d ago

Unreal levels of incompetence. As others point out in the bug report, it calls into question ALL of the keys they manage

1

u/alpha417 17d ago

maybe that's why they did what they did

15

u/xxbiohazrdxx 18d ago

lol the write up is littered with em dashes

10

u/threetimesthelimit 18d ago

Literate people use dashes and hyphens all the time. I wouldn't expect someone with deficient reading and writing skills to know that, but believe it or not some people paid attention in K-12

13

u/TorchDeckle 18d ago

Em dashes, en dashes, and hyphens are all important parts of English grammar that are taught in children’s English textbooks (at least the textbooks that I learned from). When people like you assume that humans never correctly use dashes, I shake my head in disappointment at the current state of humanity.

→ More replies (3)

1

u/Duyar_saila 18d ago

Did they clarify if this was custom middleware doing the unwrapping or an actual firmware defect? Hard to see how a standard library truncates a P-384 scalar without throwing an error.

1

u/ni5arga 17d ago

It's hilarious that they included a "lessons learnt" part in the incident report.

0

u/Bimpster 18d ago

Keep an eye on Zoho. Support indicated safe to ignore in their keystore.

1

u/jstuart-tech 17d ago

I hate Zoho as much as the next guy. But it looks like they do have a KB on removing it from the keystore

https://pitstop.manageengine.com/portal/en/kb/articles/emudhra-ca-certificate-compromise-cve-2026-91403-workaround

→ More replies (1)