Return of Coppersmith’s Attack: Vulnerable RSA Generation
crocs.fi.muni.cz
crocs.fi.muni.cz
Hopefully people will soon be able to say Infineon was ...
There are certain screwups that are egregious enough to deserve a death penalty. This is one of them. IMO nobody should ever trust a crypto chip like this from Infineon ever again.
In addition, this passage (from an Ars Technica article [0]) seems "interesting":
> The researchers went on to find 15 factorizable keys used for TLS. Strangely, almost all of them contain the string "SCADA" in the common name field. All 15 fingerprinted keys have a characteristic involving their prime numbers that is outside the range of what's produced by the faulty Infineon library, raising the possibility there was a modification of it that hasn't yet been documented.
[0]: https://arstechnica.com/information-technology/2017/10/crypt...
So does this mean people will be able to attack TPM modules? Will we be able to sign firmware or do other things device manufacturers don't want people doing?
Fair word of warning: the offline (as in, on-your-machine) tools use a cornucopia of crypto libraries, meaning that it's nontrivial to build. If you're on macOS and don't know what an LDFLAGS is, you probably want the online checker.
Yubikey has their own tool: https://www.yubico.com/keycheck/
How does the attack work? The paper isn't released yet, but here's an educated guess. The authors have already indicated that this is not another variant of [BCCC13], a paper by Bernstein et al that relied on bugs in the CSPRNG of smart cards to find weak, factorizable keys. It does appear to build on earlier research by the same authors [SNSK16]. The detection tool is released, but that only shows us what the "fingerprints" (symptoms of a weak key) are, not how to factor them.
My best guess is that this is a Coppersmith/Howgrave-Graham [HG] style attack. The crucial difference between this and previous attacks is that the problem results from poor prime selection algorithms, not limited entropy. Briefly: patterns in the low-order bits of N appear in the high-order bits of p (since N=p*q), Coppersmith allows factoring if you guess sufficient high-order bits of p correctly.
So far the results I'm seeing appear to be cryptographically catastrophic but not so much operationally catastrophic. (please don't interpret this as me speaking ill of the paper: the paper is awesome) The range of real keys I've seen is currently between $40k and $4T (yes, trillion). That's pretty bad if you're running a company CA off of a $40k key, but probably not so bad you can't afford to wait for a replacement in most cases. If the fingerprints are to be believed, some keys can be factored in a matter of hours -- but I have no idea yet what the distribution of those keys is (i.e. is it 1 in 10 or 1 in 10k?).
As usual, the issue here is different with signing keys and encryption keys. If you're not using forward-secure ciphersuites and merely signing with a smartcard key (as you typically would be with smartcard-powered SSH or TLS) and instead are really encrypting with the key itself (GPG), you've lost confidentiality on all messages once that key is compromised. A compromised signing key merely allows for forged signatures, and by then you've hopefully revoked trust in that key.
Right now I have to go deal with immigration administrivia, but I'll get back to this.
[BCCC13]: https://smartfacts.cr.yp.to/smartfacts-20130916.pdf
[SNSK16]: https://www.usenix.org/system/files/conference/usenixsecurit...
[HG]: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.144...
$ roca-detect /usr/share/ca-certificates/mozilla/
2017-10-16 13:37:50 [30012] INFO ### SUMMARY ####################
2017-10-16 13:37:50 [30012] INFO Records tested: 132
2017-10-16 13:37:50 [30012] INFO .. PEM certs: . . . 148
2017-10-16 13:37:50 [30012] INFO .. DER certs: . . . 0
2017-10-16 13:37:50 [30012] INFO .. RSA key files: . 0
2017-10-16 13:37:50 [30012] INFO .. PGP master keys: 0
2017-10-16 13:37:50 [30012] INFO .. PGP total keys: 0
2017-10-16 13:37:50 [30012] INFO .. SSH keys: . . . 0
2017-10-16 13:37:50 [30012] INFO .. APK keys: . . . 0
2017-10-16 13:37:50 [30012] INFO .. JSON keys: . . . 0
2017-10-16 13:37:50 [30012] INFO .. LDIFF certs: . . 0
2017-10-16 13:37:50 [30012] INFO .. JKS certs: . . . 0
2017-10-16 13:37:50 [30012] INFO No fingerprinted keys found (OK)
2017-10-16 13:37:50 [30012] INFO ################################I would hope that most root CA certificates are generated by and stored in HSMs but I really wouldn't be surprised to find that some little-known root CA went the cheap/easy route.
There are some biases that are far more likely in some root CAs because they’re unusually long-lived. For example, I would expect Blum primes to be more prevalent among CAs than a randomly selected leaf certificate. This is because of pre-NFS/QFS folklore that they’re safer. While this is a detectable pattern, it’s not known to produce weaker keys, though it does effectively halve your set of primes.
Yeah, and no root CA would ever do anything to violate the BRs, right? /s
tools: https://crocs.fi.muni.cz/public/papers/rsa_ccs17#detection_t...
> Note that 4096-bit RSA key is not practically factorizable now, but may become so, if the attack is improved.
I have to assume that the attack will improve and -- even if they aren't factorizable now -- will become factorizable at some future time (i.e. "just in case").