CWE-338 describes the use of a cryptographically weak pseudorandom number generator in a security-sensitive context. A PRNG can look random while still being predictable if it is seeded poorly, uses low-entropy inputs, or is not designed for cryptography. In secure software, that unpredictability is critical when generating keys, nonces, salts, initialization vectors, and wallet recovery phrases.
This weakness matters because attackers may be able to reconstruct or narrow the output space and guess secrets that should have been unguessable. In practice, the flaw often appears when developers use generic helpers such as time-based logic or non-cryptographic randomness instead of a vetted CSPRNG. Defenses focus on using platform cryptographic APIs, collecting sufficient entropy, and reviewing every code path that creates security material. If weak randomness is used once, later cryptographic steps usually cannot repair the damage.


