Show two types of forgery attacks for authenticated encryption scheme CBC-XOR.
Given a pseudorandom permutation F
Gen: k <- {0, 1}^n
Enc: On input a message m = B_0 || B_1 || ... || B_l and a key k,
uniformly generate an IV <- {0, 1}^m
1. Compute B_{l+1} = B_0 ^ B_1 ^ ... ^ B_l
2. Do CBC encryption on m || B_{l+1} using k and IV
- Output ciphertext c := IV || c_0 || c_1 || ... || c_l || c_{l+1}
Dec: On input a ciphertext c = IV || c_0 || c_1 || ... || c_l || c_{l+1} and a key k
1. Do CBC decryption on c_0 || c_1 || ... || c_l || c_{l+1} using k and IV
2. Check if B_{l+1} = B_0 ^ B_1 ^ ... ^ B_l
- If true, output plaintext B_0 ^ B_1 ^ ... ^ B_l
- If false, output error
Solution
Method 1 - Truncation
Query m=B0​∣∣B1​∣∣(B0​⊕B1​) and obtain the ciphertext c=IV∣∣c0​∣∣c1​∣∣c2​∣∣c3​.
Thus c∗=IV∣∣c0​∣∣c1​∣∣c2​ should be a valid ciphertext for m∗=B0​∣∣B1​
Method 2 - Swap
Thus
Query m=B0​∣∣B1​∣∣B2​ and obtain the ciphertext c=IV∣∣c0​∣∣c1​∣∣c2​∣∣c3​
Fk​(IV⊕B0​)=c0​
Fk​(c0​⊕B1​)=c1​
Fk​(c1​⊕B2​)=c2​
Fk​(c2​⊕B0​⊕B1​⊕B2​)=c3​
Hence c∗=IV∣∣c1​∣∣c0​∣∣c2​∣∣c3​ should be a valid tag for m∗=B1∗​∣∣B0∗​∣∣B2∗​, where