813
Example Language: Java (Bad)
public class SymmetricCipherTest {
public static void main() {
byte[] text ="Secret".getBytes();
byte[] iv ={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
KeyGenerator kg = KeyGenerator.getInstance("DES");
kg.init(56);
SecretKey key = kg.generateKey();
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, ips);
return cipher.doFinal(inpBytes);
}
}
In both of these examples, the initialization vector (IV) is always a block of zeros. This makes the
resulting cipher text much more predictable and susceptible to a dictionary attack.
Observed Examples
Reference Description
CVE-2020-5408 encryption functionality in an authentication framework uses a fixed null IV with
CBC mode, allowing attackers to decrypt traffic in applications that use this
functionality
https://www.cve.org/CVERecord?id=CVE-2020-5408
CVE-2017-17704 messages for a door-unlocking product use a fixed IV in CBC mode, which is
the same after each restart
https://www.cve.org/CVERecord?id=CVE-2017-17704
CVE-2017-11133 application uses AES in CBC mode, but the pseudo-random secret and IV are
generated using math.random, which is not cryptographically strong.
https://www.cve.org/CVERecord?id=CVE-2017-11133
CVE-2007-3528 Blowfish-CBC implementation constructs an IV where each byte is calculated
modulo 8 instead of modulo 256, resulting in less than 12 bits for the effective
IV length, and less than 4096 possible IV values.
https://www.cve.org/CVERecord?id=CVE-2007-3528
CVE-2011-3389 BEAST attack in SSL 3.0 / TLS 1.0. In CBC mode, chained initialization
vectors are non-random, allowing decryption of HTTPS traffic using a chosen
plaintext attack.
https://www.cve.org/CVERecord?id=CVE-2011-3389
Functional Areas
• Cryptography
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 959 SFP Secondary Cluster: Weak Cryptography 888 2398
MemberOf 1346 OWASP Top Ten 2021 Category A02:2021 -
Cryptographic Failures
1344 2488
MemberOf 1370 ICS Supply Chain: Common Mode Frailties 1358 2507
MemberOf 1414 Comprehensive Categorization: Randomness 1400 2543
Notes
Maintenance
CWE Version 4.14
CWE-330: Use of Insufficiently Random Values
CWE-330: Use of Insufficiently Random Values