Predictable cipher key
Encryption or decryption key is generated from a weak random number generator
Description
This defect occurs when you use a weak random number generator for the encryption or decryption key.
Risk
If you use a weak random number generator for the encryption or decryption key, an attacker can retrieve your key easily.
You use a key to encrypt and later decrypt your data. If a key is easily retrieved, data encrypted using that key is not secure.
Fix
Use a strong pseudo-random number generator (PRNG) for the key. For instance:
Use an OS-level PRNG such as
/dev/randomon UNIX® orCryptGenRandom()on Windows®Use an application-level PRNG such as Advanced Encryption Standard (AES) in Counter (CTR) mode, HMAC-SHA1, etc.
For a list of random number generators that are cryptographically
weak, see Vulnerable pseudo-random
number generator.
Examples
Result Information
| Group: Cryptography |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax:
CRYPTO_CIPHER_PREDICTABLE_KEY
|
| Impact: Medium |
PQL Name:
std.defects.CRYPTO_CIPHER_PREDICTABLE_KEY
|
Version History
Introduced in R2017a
See Also
Topics
- Interpret Polyspace Bug Finder Results in Polyspace Platform User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Polyspace Results Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)