How I almost found the eMudhra d=4 Private Key

51 points by fanf a day ago on lobsters | 8 comments

Garbi | 11 hours ago

Apologies for my shallow knowledge, but:

  1. In PKE you take two large primes and multiply them, so both the private and public keys and the product must be odd. So how could one key be 4?

  2. If the private key is tiny then the public key must be huge. Wouldn't that be noticed?

These properties are only true of RSA, which relies on prime number factoring for its security properties. ECDSA works by selection of a point on an elliptic curve, which means private keys can be any random number that fits within the intervals of the curve parameters chosen (Wikipedia: Elliptic Curve Digital Signature Algorithm§Signature generation algorithm).

aaronm04 | 10 hours ago

To expand on that, the public key looks the same whether the private key is a small or a large number.

Garbi | 3 hours ago

Thank you both

alandekok | 11 hours ago

What mystifies me is how crypto software doesn't reject bad keys. i.e. If OpenSSL is asked to do a crypto operation with a private key of 4, can it not detect that, and refuse to do the operation?

gerikson | 10 hours ago

We don't know the internals of how these keys were generated (although the known values really do point in someone very lazily punching keys on a keyboard). For all we know it was a testing framework that somehow got hooked up to production. Or the cert generation software was silently swallowing warnings about weak keys.

[OP] fanf | 9 hours ago

We know a fair amount about the eMudhra cockup: the keys were generated on an HSM, then a special script was used to export the keys so that they could be used by HSMs in Europe. The script somehow managed to truncate the private keys. https://bugzilla.mozilla.org/show_bug.cgi?id=2083449#c82

alandekok | 6 hours ago

But once the key has been exported, presumably something was using it to sign new certs. Can that signing code not check for bad keys?

Maybe I'm missing something.