(a) Ruhr strikes again.

(b) This is one of the all-time great cryptography footguns: not filling the ECDSA modulus.

Couldn't be any more thrilled.

https://www.openwall.com/lists/oss-security/2024/04/15/6

oss-security - CVE-2024-31497: Secret Key Recovery of NIST P-521 Private Keys Through Biased ECDSA Nonces in PuTTY Client

Sean's writeup of the mechanics of this attack in his Cryptopals set 8 is *so good*.

https://cryptopals.com/sets/8/challenges/62.txt

The big thing here is is a programmer-brain impedance mismatch.

You need a cryptographically random 521 bit modulus, to work P-521. Your libraries easily generate 512-bit moduli. 512 bits seems essentially as cryptographically unguessable as 521 bits. If these were like, AES keys, the distinction would not matter.

But it matters a fuckload in asymmetric cryptography, because 521-512 leaves 9 bits biased to 0, which over a collection of signatures lets you set up a linear algebra problem to recover the secret key.

I don't keep up with any of this literature but last time I checked there was like an academic arms race to see just how few bits of bias you'd need to solve for a private key, and the 1-bit barrier was broken a long time ago.

Also: this is the bug Alex wrote an exploit for in the Hiring Post I wrote at Matasano.

https://sockpuppet.org/blog/2015/03/06/the-hiring-post/

The Hiring Post — Quarrelsome

The unstoppable Kelby Ludwig wrote an IPython notebook that works through examples from Boneh's Hidden Number Problem paper, is a good overview, and will steer you around some comprehension pitfalls:

https://github.com/kelbyludwig/notebooks/blob/master/The%20Hidden%20Number%20Problem.ipynb

notebooks/The Hidden Number Problem.ipynb at master · kelbyludwig/notebooks

Sage and Python notebooks covering various subjects - kelbyludwig/notebooks

GitHub

@tqbf Related work that does the same thing with a side-channel exposed by smartcards: https://minerva.crocs.fi.muni.cz/

We're all sure our ECDSA signatures can't be measured or are constant time in the length of the modulus, right?

Minerva

Minerva is a group of side-channel vulnerabilities in implementations of ECDSA in programmable smart cards and cryptographic software libraries. This page describes our attack which allows for practical recovery of the long-term private key.

@tqbf 1-bit barrier was broken using Bleichenbacher FFT, with a lot of signatures. For crypto, best lattice break is Albrecht/Heninger "On Bounded Distance Decoding with Predicate: Breaking the Lattice Barrier for the Hidden Number Problem", which was just improved by Gao, Wang, Hu, He "Attacking ECDSA with Nonce Leakage by Lattice Sieving: Bridging the Gap with Fourier Analysis-based Attacks". The latter is pre-print only so far, but reports lattice attack with sub-1-bit leak for 160bit ECDSA.
@tqbf "programmer-brain impedance mismatch" is an incredibly pretentious way to say something incredibly simple. don't pretend like mathematics is some sort of fucking lost art only interpretable by the chosen divine messengers, that does not at all help anyone to understand how to process this in the future and only contributes to self-esteem issues
@tqbf reading posts like this is much more annoying than someone just telling me not to write my own crypto because they're not telling me i'm "programmer-brained" for something it's implied i would never have thought of myself