I saw an OpenSSL security advisory for Openssl 0.9.6a

Recently a cryptographic flaw in OpenSSL's built-in pseudo-random number generator (PRNG) was pointed out to us by Markku-Juhani O. Saarinen , who showed how an attacker could reconstruct the PRNG's internal state from the output of a couple of hundred 1-byte PRNG requests. This problem dates back to SSLeay, which OpenSSL is based on, and was found in other SSLeay-based toolkits as well. While a number of enhancements have been done to the original PRNG during the development of OpenSSL, this design error was overlooked so far.

The PRNG (implemented in source code file crypto/md_rand.c) uses a hash function, by default SHA-1, to update its internal secret state and to generate output. The secret state consists of two components: A chaining variable 'md', sized according to the hash function's output (160 bits for SHA-1), and a large buffer 'state'. 'md' is always replaced by a hash function output during the PRNG's operation. 'state' is accessed circularly and is used for storing additional entropy.

When generating output bytes, OpenSSL versions up to 0.9.6a set 'md' to the hash of one half of its previous value and some other data, including bytes from 'state'. The design error was that the half of 'md' input to the hash function was the same half that was also used as PRNG output, meaning that it in general cannot be considered secret. Also the number of bytes used from 'state' depended on the number of bytes requested as PRNG output and could be as small as one, allowing for easy brute-force analysis of all possible cases. The combination of these effects made it possible to reconstruct the complete internal PRNG state from the output of one PRNG request appropriately sized to gain knowledge on 'md' followed by enough consecutive 1-byte PRNG requests to traverse all of 'state'.

See also: SecurityTracker Alert ID: 1001961

  • 3
    That patch is from 2001. Are you trying to attack a version of OpenSSL that's been unpatched for 14 years? Oct 6, 2015 at 8:27
  • 2
    @StackzOfZtuff: I am just trying to understand the technique behind it. Do you have any idea? Oct 6, 2015 at 8:36
  • 1
    No. I just had a hunch, that there are probably bigger holes/easier targets in such an old version. Oct 6, 2015 at 8:38

1 Answer 1


From the security advisory that you posted, it appears to me that the design error can be summarised as

The PRNG is a hash function. the input to the PRNG(hash function), half of it is from the previous PRNG output, which is known, you can just read it off the previous output. So essentially the hash-function SHA-1's strength becomes halved - 80 bits instead of 160 bits.

So if the OpenSSL's libray is used in key generation, you may perform a brute force attack on the remaining 80 bits key. It is definitely a big vulnerability and breakable by today's processing power standard. But it is still a huge task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.