Why is using a Non-Random IV with CBC Mode a vulnerability?

Solution 1:

Predictable IVs can be exploited by chosen plain text.

Pretend that Eve is a DBA at an insurance company. The company collects medical histories from beneficiaries that include a lot of true/false check boxes about medical conditions. This company also happens to its own health insurance provider. Eve realizes that Alice could be blackmailed if she can discover that Alice has a particularly embarrassing medical condition. However, the value in each of these fields is encrypted, so even though Eve is the DBA, she only has access to the cipher text.

In CBC, the IV is XORed (noted by "⊕" below) with the plain text, then run through the block cipher: C1 = Ek(IV ⊕ P1).

Since Eve is a beneficiary of the insurance company, she can choose the plain text for her own medical record, and since she is the DBA, she can examine anyone's cipher text. In addition to using predictable IVs, the sloppy application developer did a poor job of validating the application inputs. If Eve can predict the IVs that will be applied to her (IVeve) and Alice's (IValice) records in advance, she can choose the plain text for her own record like this: Peve = IVeve ⊕ IValice ⊕ "false"

The application encrypts this plain text like this:

Ceve = Ek(IVeve ⊕ Peve) = Ek(IVeve ⊕ (IVeve ⊕ IValice ⊕ "false"))

The IVeve ⊕ IVeve cancels out, which means that Ceve = Ek(IValice ⊕ "false")

Now Eve can compare Ceve and Calice. If they are different, she knows that Alice must have entered "true" for that medical condition.

Making IVs unpredictable thwarts this attack, and an easy way to make them unpredictable is to choose them randomly after the plain text has been supplied.

Solution 2:

i want to explain your question by using WEP which is vulnerable and now other protocols such as WPA2 is used.

the simple rule IEEE says that :

Basic rule is never use a key+IV twice, ever

One of the reason that WEP is compromised is due to the reason of IV generation.

alt text

As seen in the picture, when WEP first appeared the length of the IV was 24 bits (later it is increased 48 bits) if the attacker knows the how the IV are generated or in this situation IVs are small enough for the attacker to exploit the messages.

If anyone knows about the generation of the IV or it overlaps (because IVs are 24 bits it means 2^24 IVs) during the transmission of the packets the attacker who is sniffing the traffic can : if the IVs are sequential it means still there is a possibility that the IVs will be overlap in some time.

let's assume,

passphrase key Kp

initialization vector Ivi

plaintext data D1, D2 (for separateblocks)

Traffic Key:Kti=Kp||Ivi

Ciphertext: E(Kti,Di)=RC4(Kti) xor Di

and assume that

IV1=IV2  (created sequentially and from 0 to 2^24 again returns back)

Attacker has,

(RC4(Kt1) xor D1) Xor  (RC4(Kt1) xor D2) = D1 XOR D2

This can be broken by using Aircrack-NG using network traces. The idea that i showed is the basic one more complex assumption can be made, again never ever use same IV that will overlap.

Solution 3:

The other answers are good, though highly technical.

Why is using a Non-Random IV with CBC Mode a vulnerability?

When you encrypt data with a key, if the data and the key are the same (have not changed) then the encrypted data will be the same. If the encrypted data is the same then sets of encrypted data can be analyzed for patterns which can then be used to gain knowledge about the encrypted data.

CBC (Cipher Block Chaining) resolves this issue by XORing the encrypted data from the previous bock with the data to be encrypted. This means that blocks with the same data will be different if the encrypted data from the previous block is different, even if the keys are the same.

The problem with CBC is what to do with the first block, since there is no previous block to get the encrypted data from. Instead, the data is XORed with a block of random bits called an IV (Initialization Vector).

You can consider the security of the IV to be the same as the security of the encrypted data blocks. In other words, if they can be given the encrypted data then they can also be given the IV.