Home
Writeups Misc About
Nothing Up My Sleeve

Nothing Up My Sleeve

This challenge is about the Dual_EC_DRBG random number generator, which is famous for being backdoored by the NSA so they can predict the output after reading only 32 bytes of the random stream.

This excellent video should demonstrate how to generate the point Q so that we can easily recover the state of the PRNG given that we know the relation of P=dQ, where d is the secret component only known by the NSA. We can make our life easier by setting d=1, to make the output of the PRNG to be the next state that the PRNG uses.

The algorithm only returns the last 240 bits (basically truncates the first 16 bits), we have to do some guesswork of the states. The Shumow-Ferguson attack, mentioned by part 5.3 of the original paper about DUAL_EC_DRBG, should provide some insights on how to brute force the most significant 16 bits. Denote the two state, in chronological order that we can observe to be s1 and s2. We will brute force the most significant 16 bits of s1, and for each guess, we generate the next state from the guess, denoted by s1. The correct guess of the most significant 16 bits will occur when s1=s2 (truncated s1 of course).

It takes around 47 spins for a full recovery of the 240 least significant bits of a state output (the 16 most significant bits truncated state). We can do a simple random choice between ODD and EVEN to recover 2 state outputs, and the remaining number of spins should be enough for 1000 points.

Python Implementation: