Applied Cryptography

A server receiving data encrypted in CBC mode returned different errors when the padding after decryption was incorrect and when the padding was correct but the check of the contents failed. Which of the following correctly describes this situation?

  1. AAn attacker can send modified ciphertexts and, using the difference in errors as a clue, may recover the plaintext byte by byte without knowing the key
  2. BThe difference in errors only reveals the length of the padding, so the contents of the plaintext themselves cannot leak unless the key leaks
  3. CChanging the key from AES-128 to AES-256 removes the risk of the plaintext being recovered from the difference in errors
Show answer and explanation

Answer: A. An attacker can send modified ciphertexts and, using the difference in errors as a clue, may recover the plaintext byte by byte without knowing the key

In CBC decryption, flipping a bit in one ciphertext block flips the bit at the same position in the decrypted result of the next block. By sending variants of the last byte of the preceding block and looking for a value judged as "correct padding", an attacker finds the last byte of the plaintext, and by repeating this reveals the plaintext one byte at a time. This is the padding oracle attack, in which differences in error types or response times act as the clue (the oracle). The basic countermeasures are to use authenticated encryption such as GCM, or to verify a MAC attached to the ciphertext first and uniformly reject tampered ciphertexts before decrypting them.

  • A. Correct. Responses that only reveal whether the padding is valid are enough to recover the plaintext byte by byte.
  • B. Knowing whether the padding is valid, combined with modifying the ciphertext, makes it possible to recover the plaintext itself.
  • C. This attack does not recover the key; it uses the properties of CBC mode and the difference in errors, so changing the key length does not prevent it.
Practice this topic Back to topic

Books on Applied Cryptography Ad

As an Amazon Associate I earn from qualifying purchases.

More Applied Cryptography questions

  1. Which of the following correctly describes a feature of CTR mode (counter mode) of a block cipher?
  2. In CTR mode, two messages were mistakenly encrypted with the same key and the same nonce. For the byte at one position, the first plaintext P₁ is 01001000 (ASCII "H"), its ciphertext C₁ is 01110100 and the second ciphertext C₂ is 01010101. If the attacker knows P₁, which of the following is the second plaintext P₂ at the same position?
  3. Which of the following does authenticated encryption (AEAD) such as AES-GCM provide in a single operation?
  4. Which of the following correctly describes the 96-bit nonce (IV) used in AES-GCM?
  5. On a certain machine, a brute-force search trying every 56-bit key takes about 20 hours. Which of the following is closest to the time the same machine needs to try every 64-bit key?

Comparisons in this topic