Using a cryptographically weak pseudo-random number generator
This defect occurs when you use cryptographically weak pseudo-random number generator (PRNG) routines.
The list of cryptographically weak routines flagged by this checker include:
rand, random
drand48, lrand48, mrand48, erand48, nrand48, jrand48,
and their _r equivalents such as drand48_r
RAND_pseudo_bytes
These cryptographically weak routines are predictable and must not be used for security purposes. When a predictable random value controls the execution flow, your program is vulnerable to malicious attacks.
Use more cryptographically sound random number generators, such
as CryptGenRandom (Windows), OpenSSL/RAND_bytes(Linux/UNIX).
| Group: Security |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax: VULNERABLE_PRNG |
| Impact: Medium |
| CWE ID: 330, 338 |
Deterministic random output from constant seed | Find defects (-checkers) | Predictable random output from predictable seed | Unsafe standard encryption function