1988
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 330 Use of Insufficiently Random Values 814
ParentOf 329 Generation of Predictable IV with CBC Mode 811
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 310 Cryptographic Issues 2318
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Confidentiality Read Application Data
If the IV is not properly initialized, data that is encrypted
can be compromised and information about the data can
be leaked. See [REF-1179].
Potential Mitigations
Phase: Implementation
Different cipher modes have different requirements for their IVs. When choosing and
implementing a mode, it is important to understand those requirements in order to keep
security guarantees intact. Generally, it is safest to generate a random IV, since it will be both
unpredictable and have a very low chance of being non-unique. IVs do not have to be kept
secret, so if generating duplicate IVs is a concern, a list of already-used IVs can be kept and
checked against. NIST offers recommendations on generation of IVs for modes of which they
have approved. These include options for when random IVs are not practical. For CBC, CFB,
and OFB, see [REF-1175]; for GCM, see [REF-1178].
Demonstrative Examples
Example 1:
In the following examples, CBC mode is used when encrypting data:
Example Language: C (Bad)
EVP_CIPHER_CTX ctx;
char key[EVP_MAX_KEY_LENGTH];
char iv[EVP_MAX_IV_LENGTH];
RAND_bytes(key, b);
memset(iv,0,EVP_MAX_IV_LENGTH);
EVP_EncryptInit(&ctx,EVP_bf_cbc(), key,iv);
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
};
CWE Version 4.14
CWE-1204: Generation of Weak Initialization Vector (IV)
CWE-1204: Generation of Weak Initialization Vector (IV)