Exécuter une analyse statique (SAST) sur le code source à la recherche du motif non sécurisé dans le flux de données.
Generation of Weak Initialization Vector (IV)
This vulnerability occurs when software uses a weak or predictable Initialization Vector (IV) for cryptographic operations. Many encryption algorithms require IVs to be both unique and unpredictable…
What is CWE-1204?
Real-world CVEs caused by CWE-1204
-
ZeroLogon vulnerability - use of a static IV of all zeroes in AES-CFB8 mode
-
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.
-
wireless router does not use 6 of the 24 bits for WEP encryption, making it easier for attackers to decrypt traffic
-
WEP card generates predictable IV values, making it easier for attackers to decrypt traffic
-
device bootloader uses a zero initialization vector during AES-CBC
-
crypto framework uses PHP rand function - which is not cryptographically secure - for an initialization vector
-
encryption routine does not seed the random number generator, causing the same initialization vector to be generated repeatedly
-
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
Parcours de l'attaquant étape par étape
- 1
In the following examples, CBC mode is used when encrypting data:
- 2
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.
- 3
The Wired Equivalent Privacy (WEP) protocol used in the 802.11 wireless standard only supported 40-bit keys, and the IVs were only 24 bits, increasing the chances that the same IV would be reused for multiple messages. The IV was included in plaintext as part of the packet, making it directly observable to attackers. Only 5000 messages are needed before a collision occurs due to the "birthday paradox" [REF-1176]. Some implementations would reuse the same IV for each packet. This IV reuse made it much easier for attackers to recover plaintext from two packets with the same IV, using well-understood attacks, especially if the plaintext was known for one of the packets [REF-1175].
Vulnerable C
In the following examples, CBC mode is used when encrypting data:
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); Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
const safe = validateAndEscape(input);
return executeWithGuards(safe);
} How to prevent CWE-1204
- 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].
How to detect CWE-1204
Exécuter des tests de sécurité applicative dynamique (DAST) contre le point de terminaison en ligne.
Surveiller les journaux runtime pour détecter des traces d'exception inhabituelles, des entrées malformées ou des tentatives de contournement d'autorisation.
Revue de code : signaler tout nouveau code qui traite les entrées de cette surface sans utiliser les helpers du framework validés.
Plexicus détecte automatiquement CWE-1204 et ouvre une PR de correction en moins de 60 secondes.
Codex Remedium analyse chaque commit, identifie cette faiblesse précise et livre une pull request prête à être relue avec le correctif. Pas de tickets. Pas de transferts.
Frequently asked questions
Qu'est-ce que CWE-1204 ?
This vulnerability occurs when software uses a weak or predictable Initialization Vector (IV) for cryptographic operations. Many encryption algorithms require IVs to be both unique and unpredictable to ensure security, and failing to meet these requirements can compromise the entire encryption process.
Quelle est la gravité de CWE-1204 ?
MITRE n'a pas publié de note de probabilité d'exploitation pour cette faiblesse. Traitez-la comme un impact moyen jusqu'à ce que votre modèle de menace prouve le contraire.
Quels langages ou plateformes sont affectés par CWE-1204 ?
MITRE n'a pas spécifié les plateformes affectées pour ce CWE — il peut s'appliquer à la plupart des stacks applicatives.
Comment puis-je prévenir CWE-1204 ?
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…
Comment Plexicus détecte et corrige CWE-1204 ?
Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-1204 à chaque commit. Lorsqu'une correspondance est trouvée, notre agent Codex Remedium ouvre une PR de correction avec le code corrigé, les tests et un résumé d'une ligne pour le relecteur.
Où puis-je en savoir plus sur CWE-1204 ?
MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/1204.html. Vous pouvez également consulter la documentation OWASP et NIST pour des conseils adjacents.
Weaknesses related to CWE-1204
Use of Insufficiently Random Values
This vulnerability occurs when an application uses random values that are not sufficiently unpredictable in security-sensitive operations,…
Use of Predictable Algorithm in Random Number Generator
This vulnerability occurs when a device or application relies on a predictable algorithm to generate pseudo-random numbers, making the…
Insufficient Entropy
This vulnerability occurs when a system's random number generator or algorithm lacks sufficient unpredictability, creating patterns or…
Small Space of Random Values
This vulnerability occurs when a system uses a random number generator that produces too few possible values. Attackers can easily predict…
Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG)
This vulnerability occurs when a Pseudo-Random Number Generator (PRNG) is used, but its initial seed value is not handled securely or…
Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
This vulnerability occurs when software uses a pseudo-random number generator (PRNG) that is not cryptographically strong for…
Generation of Predictable Numbers or Identifiers
This vulnerability occurs when a system creates numbers or identifiers that are too easy to guess, undermining security mechanisms that…
Use of Invariant Value in Dynamically Changing Context
This vulnerability occurs when code uses a fixed, unchanging value (like a hardcoded string, number, or reference) in a situation where…
Generation of Predictable IV with CBC Mode
This vulnerability occurs when software uses a predictable or reused Initialization Vector (IV) with Cipher Block Chaining (CBC) mode…
Further reading
- MITRE — CWE-1204 officiel https://cwe.mitre.org/data/definitions/1204.html
- Intercepting Mobile Communications: The Insecurity of 802.11 http://www.isaac.cs.berkeley.edu/isaac/mobicom.pdf
- Intercepting Mobile Communications: The Insecurity of 802.11 http://www.isaac.cs.berkeley.edu/isaac/mobicom.pdf
- Birthday problem https://en.wikipedia.org/wiki/Birthday_problem
- Initialization Vector https://en.wikipedia.org/wiki/Initialization_vector
- Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
- CBC Mode is Malleable. Don't trust it for Authentication https://arxumpathsecurity.com/blog/2019/10/16/cbc-mode-is-malleable-dont-trust-it-for-authentication
Arrêtez de payer par développeur.
Commencez à fermer la boucle.
Plexicus est l'ASPM natif IA qui scanne, filtre, corrige, penteste et explique — de façon autonome. Développeurs illimités, dépôts illimités, actions IA à usage équitable. Vrai niveau gratuit, €269/mo annuel quand vous êtes prêt.