Post
Topic
Board Development & Technical Discussion
Merits 8 from 2 users
Re: Reused Nonce r Between Different Private Keys – Possible MT19937 Issue
by
ABCbits
on 09/04/2025, 09:03:59 UTC
⭐ Merited by pooya87 (4) ,vapourminer (4)
Has anyone seen a similar case involving MT19937 and nonce/key reuse?

Full disclosure of milksad vulnerability mention MT19937 used by older version of bx binary.

We follow the call path:
pseudo_random::fill(data_chunk& out) -> pseudo_random::next() -> pseudo_random::next(uint8_t begin, uint8_t end) -> std::mt19937& pseudo_random::get_twister()

Wait a moment. mt19937, twister - this uses the Mersenne Twister PRNG? 🤔
At this point, the first alarm bells are going off. Mersenne Twister is not a CSPRNG, so it shouldn’t be in any code path that generates secrets. One alarming property of the Mersenne Twister is that its internal state can be reversed by an attacker who knows a few hundred outputs, endangering the secrecy of the other outputs of the same stream that the attacker doesn’t know (in simplified terms).