Vulnerable pseudo-random number generator
Using a cryptographically weak pseudo-random number generator
Description
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- _requivalents such as- drand48_r
- RAND_pseudo_bytes
Risk
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.
Fix
Use more cryptographically sound random number generators, such
as CryptGenRandom (Windows), OpenSSL/RAND_bytes(Linux/UNIX).
Examples
Result Information
| Group: Security | 
| Language: C | C++ | 
| Default: Off | 
| Command-Line Syntax: VULNERABLE_PRNG | 
| Impact: Medium | 
Version History
Introduced in R2015b
See Also
Deterministic random output from constant seed | Predictable random output from predictable seed | Unsafe standard encryption function | Find defects (-checkers)
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)