Entropy Starvation & Weak-Key Bugs
Study the Debian OpenSSL RNG bug and other real randomness failures.
Entropy Starvation & Weak-Key Bugs is a free Cryptology Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Entropy Starvation?
Entropy starvation occurs when a system lacks sufficient unpredictable input to seed its CSPRNG. This happens on newly booted embedded devices, virtualized servers, or systems with no user input. The RNG output becomes predictable.
The Debian OpenSSL Bug (CVE-2008-0166)
In 2006, a Debian developer removed a line flagged by Valgrind: MD_Update(&m, buf, j). This line was the entropy source. The result: OpenSSL on Debian only seeded with the PID (max 32,768 values). All keys generated 2006-2008 are in a set of 32,768 possibilities.
Impact of the Debian Bug
RSA, DSA, and ECDSA keys, SSH host keys, TLS certificates, and SSL VPN keys generated on Debian/Ubuntu systems 2006-2008 were compromised. Affected systems: Debian Etch, Debian Lenny, Ubuntu 7.04-8.04. Blacklists were published; certificates revoked.
Virtual Machine RNG Problem
VMs can be cloned with identical disk state. If both VMs generate keys from the same CSPRNG state, they produce the same keys. Hypervisors now inject entropy via VirtIO RNG or ACPI tables, but poorly configured VMs still face this risk at boot.
Embedded Systems and IoT
IoT devices (routers, cameras) often generate SSH/TLS keys at first boot before accumulating entropy. Studies found millions of devices sharing a few thousand RSA key pairs because they all seeded from the same low-entropy boot state.
GCD Attack on RSA Keys
Lenstra et al. (2012) collected 11.7 million TLS certificates and computed pairwise GCDs. Found 12,720 RSA keys sharing a prime factor — meaning both keys could be fully factored. 0.2% of all public keys were broken. Cause: insufficient boot entropy.
Nonce Reuse in ECDSA
ECDSA requires a unique random nonce k per signature. If k is reused (or weak), the private key is immediately recoverable: d = (s1-s2)^{-1} * (z1-z2) * k / (r1-r2) mod n. Sony's PS3 used k=constant — all games could be signed with the recovered key.
Android Bitcoin Wallet Bug (2013)
Java SecureRandom on Android 4.x was seeded with system time in certain conditions. Multiple Bitcoin wallet apps generated signatures with the same k nonce, leaking private keys. Millions of dollars were stolen. Google patched SecureRandom implementation.
Detecting Weak Keys
Tools: ssh-vulnkey (checks against Debian weak key blacklist), badkeys (checks TLS certs for known-weak primes), GCD-batch algorithm for bulk RSA key auditing. Certificate Transparency logs enable population-scale analysis.
Mitigations
Use getrandom(GRND_RANDOM) at first key generation. Read from /dev/urandom after waiting for initial seeding (check /proc/sys/kernel/random/entropy_avail > 128). Use hardware RNG (RDRAND) as supplemental entropy. Never generate keys at first boot without delay.
Seed File Persistence
Persist CSPRNG state across reboots: save 32 bytes from /dev/urandom to a seed file at shutdown; read and feed back at boot. This provides continuity of entropy across cold boots. Linux does this automatically; embedded systems often do not.
Quick Check
What was the root cause of the Debian OpenSSL entropy bug?
Recap
Entropy starvation causes predictable keys. Real breaks: Debian OpenSSL (PID-only seed), IoT GCD attacks, PS3 ECDSA nonce reuse, Android Bitcoin wallet. Always seed from OS entropy; audit embedded key generation carefully. Next: generating keys, nonces, and IVs safely.
Frequently asked questions
Is the “Entropy Starvation & Weak-Key Bugs” lesson free?
Yes — the full text of “Entropy Starvation & Weak-Key Bugs” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.
What will I learn in “Entropy Starvation & Weak-Key Bugs”?
Study the Debian OpenSSL RNG bug and other real randomness failures. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cryptology Academy?
No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Entropy Starvation & Weak-Key Bugs” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cryptology Academy lesson?
Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- True Randomness vs Pseudorandomness
- Cryptographically Secure PRNGs
- Entropy Starvation & Weak-Key Bugs
- Generating Keys, Nonces & IVs Safely