Skip to main content
RNG FlawYear: 2008Severity: Critical

Debian OpenSSL PRNG Predictability Bug

CVE-2008-0166: 32,768 total possible SSH & SSL keys across Debian

#OpenSSL PRNG#RSA Keygen#DSA Signatures#SSH Keys

Incident Overview

In May 2008, Debian announced that the PRNG in its OpenSSL package had been broken since September 2006. The only random seed remaining was the process ID (PID), capped at 32,768, allowing attackers to pre-compute all possible global keypairs.

Real-World Impact

All SSH, SSL/TLS, and OpenVPN keys generated on Debian, Ubuntu, and derivative Linux distros between 2006 and 2008 were completely predictable.

Technical Root Cause Analysis

A maintainer removed two lines of code in OpenSSL (`MD_Update(&m, &buf, n)`) to fix Valgrind uninitialized memory warnings, eliminating uninitialized stack memory from the PRNG entropy pool.

  • Removed Entropy Code: `MD_Update(&m, &buf, n);` was commented out because Valgrind flagged reading uninitialized stack memory as a warning.
  • PID Entropy Collapse: The PRNG state depended solely on `getpid()`. On Linux, PIDs max out at 32,768 by default.
  • Pre-computed Exploitation: Attackers generated pre-computed public key lookup tables and scanned SSH servers worldwide, gaining instant root shell access.

Fatal Code Removal in OpenSSL md_rand.c

/* Commented out by Debian maintainer to quiet Valgrind: */
/* MD_Update(&m, &buf, n); */

/* Result: PRNG entropy pool initialized ONLY with process ID (0 to 32767) */
unsigned long pid = getpid();
MD_Update(&m, &pid, sizeof(pid));

Incident Timeline

2006-05

Debian package maintainer removes Valgrind warning code lines from OpenSSL md_rand.c.

2008-05-13

Luciano Bello discovers PRNG predictability; Debian issues DSA-1571 patch.

2008-05-14

Security community publishes pre-generated lookup tables containing all 32,768 SSH key pairs.

Key Engineering Takeaway & Defensive Guidance

Never remove entropy sources from pseudo-random number generators without deep cryptographic review. Static analysis tools must understand intentional entropy gathering.