Initialization vector is constant instead of randomized
This defect occurs when you use a constant for the initialization vector (IV) during encryption.
Using a constant IV is equivalent to not using an IV. Your encrypted data is vulnerable to dictionary attacks.
Block ciphers break your data into blocks of fixed size. Block cipher modes such as CBC (Cipher Block Chaining) protect against dictionary attacks by XOR-ing each block with the encrypted output from the previous block. To protect the first block, these modes use a random initialization vector (IV). If you use a constant IV to encrypt multiple data streams that have a common beginning, your data becomes vulnerable to dictionary attacks.
Produce a random IV by using a strong random number generator.
For a list of random number generators that are cryptographically
weak, see Vulnerable pseudo-random
number generator.
| Group: Cryptography |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax: CRYPTO_CIPHER_CONSTANT_IV |
| Impact: Medium |
| CWE ID: 310, 326, 329 |