CBC Bit Flipping Attack
An attack on CBC-mode encryption where modifying ciphertext bytes causes predictable changes in the next decrypted block, enabling content manipulation.
CBC Bit Flipping Attack exploits the chaining property of CBC mode encryption. By flipping bits in one ciphertext block, an attacker can make predictable changes to the next decrypted plaintext block, potentially modifying data like user roles or amounts.
How CBC Works
Encryption:
C[i] = Encrypt(P[i] XOR C[i-1])
Decryption:
P[i] = Decrypt(C[i]) XOR C[i-1]
// Key insight: modifying C[i-1] affects P[i]
Trade-off
The block you modify (C[i-1]) decrypts to garbage. Attackers must ensure this doesn't break parsing or is in a non-critical field.
Prevention
- Use authenticated encryption (AES-GCM)
- Add HMAC over ciphertext (encrypt-then-MAC)
- Validate data integrity before processing