CWE-330 in the wild, breaches caused by weak randomness
CWE-330, "Use of Insufficiently Random Values", is the class covering every failure where predictable values were used where unpredictable ones were required. It is the root of a family that reaches key generation, session tokens, initialisation vectors, nonces and password resets.
One weakness, many symptoms
CWE-330 sits above a group of related entries — predictable seeds, insufficient entropy, use of a cryptographically weak PRNG, reuse of a nonce. They describe different symptoms of the same underlying condition: a value that had to be unpredictable was not.
Grouping them matters because the fixes look unrelated while the cause is identical. Patching each symptom individually leaves the condition in place.
Where it appears
- Key generation. The most severe case: a predictable key is a compromised key for as long as it is in service, discoverable years later.
- Session tokens. Predictable identifiers let an attacker guess another user's session, and this remains one of the most common real-world instances.
- Nonces and IVs. Many modes fail catastrophically on reuse. ECDSA with a repeated nonce leaks the private key outright, from two signatures.
- Password reset tokens. Frequently generated with a general-purpose PRNG because the code was written where randomness was not the concern.
- Anything hedging with a timestamp. Seeding from the clock is the classic, because the clock is public.
Why it persists
A weak random value never announces itself. Everything works, tests pass, and the defect is invisible until someone attacks it deliberately. There is no crash, no error and no log line.
The failure is also usually not where the mistake was. The mistake is the source; the symptom is a signature, a token or a key — which is why the case histories are the most persuasive teaching material available.
What actually prevents it
Using the operating system's cryptographic generator instead of a general-purpose PRNG prevents most instances. Beyond that, the questions are whether the OS generator is well seeded on your platform, whether it is seeded at first boot on an embedded device, and whether anyone would know if the underlying source degraded — the boot and virtualisation cases are where this bites hardest.
Keep reading
- Where entropy breaks
Entropy in HSMs and secure elements
An HSM or secure element generates keys internally, so its entropy source is the root of everything it protects. What the module's certification covers, and whether the entropy claim is evidenced within its boundary, decide how much the certificate actually tells you.
- Where entropy breaks
Entropy starvation at boot, in virtual machines and containers
Entropy starvation happens when a system needs randomness before its sources have produced enough — most commonly at first boot on embedded devices, in freshly cloned virtual machines, and in containers that inherit a host state. The usual workarounds trade the problem for a weaker one.
- Where entropy breaks
Famous RNG failures, from Debian OpenSSL to shared RSA keys
The best-known randomness failures — the Debian OpenSSL key generation defect, Android wallet key collisions, and the large-scale surveys that found shared RSA factors across internet hosts — share a pattern. The algorithms were sound and the material fed into them was not.