Padding oracle attack

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Lua error in package.lua at line 80: module 'strict' not found. In cryptography, a padding oracle attack is an attack which is performed using the padding of a cryptographic message. In cryptography, variable-length plaintext messages often have to be padded (expanded) to be compatible with the underlying cryptographic primitive. The attack relies on having a "padding oracle" who freely responds to queries about whether a message is correctly padded or not. Padding oracle attacks are mostly associated with CBC mode decryption used within block ciphers. Padding modes for asymmetric algorithms such as OAEP may also be vulnerable to padding oracle attacks.[1]

Symmetric cryptography

In symmetric cryptography, the padding oracle attack can be applied to the CBC mode of operation, where the "oracle" (usually a server) leaks data about whether the padding of an encrypted message is correct or not. Such data can allow attackers to decrypt (and sometimes encrypt) messages through the oracle using the oracle's key, without knowing the encryption key.

Example of the attack on CBC encryption

Suppose the attacker has three ciphertext blocks C_1, C_2, C_3 and he wants to decrypt the second block (get plaintext P_2). He only knows that the very last block C_3 is padded correctly and the padding method is PKCS7, which means that the last block is padded with n bytes, each equal to n (for example: six bytes, each byte = 0x06).

CBC decryption works as follows: P_i = D_K(C_i) \oplus C_{i-1}, C_0 = IV. If the attacker changes the last byte of C_1 and sends (IV,C_1,C_2) to the server, it will affect the whole block P_1 (because of decryption avalanche effect) and the last byte of P_2 (because of XORing operation). Then the server checks the padding of the last decrypted block (which is P_2), and returns whether or not the padding is correct (this check is performed before the actual processing of the plaintext message).

Let b_{-1} be the last byte of C_1. The attacker changes it as follows: b_{-1} = b_{-1} \oplus z_{-1} \oplus \text{0x01}, where z_{-1} is the guessed value of the last byte of P_2. If z_{-1} were a shrewd guess (the exact value of P_2's last byte) the server will not raise a padding error (because the last byte of P_2 becomes equal to 0x01, which is correct padding). In the other case, the server will report a padding error and the attacker will try the next value of z_{-1}. In the worst case, he needs to make 255 attempts to find the right value of z_{-1}, (one guess for every possible byte).

After he knows the last byte of P_2, the attacker can obtain the second-to-last byte of P_2. He changes the last two bytes of C_1: b_{-1} = b_{-1} \oplus z_{-1} \oplus \text{0x02} and b_{-2} = b_{-2} \oplus z_{-2} \oplus \text{0x02}. Now he tries to find the value z_{-2}, which results in the correct padding (0x02,0x02). After no more than 255 guesses he will get it and proceed to z_{-3} and so on.

If any block consists of 128 bits (AES, for example), which is 16 bytes, the attacker will obtain plaintext P_2 in no more than 255⋅16 = 4080 attempts. This attack costs practically nothing and can be performed in a few seconds (depending on the server's speed).

Attacks using padding oracles

The original attack was published in 2002 by Serge Vaudenay.[2] The attack was applied to several web frameworks, including JavaServer Faces, Ruby on Rails[3] and ASP.NET[4][5][6] as well as other software, such as Steam gaming client.[7] In 2012 it was shown to be effective against some hardened security devices.[8]

While these earlier attacks were fixed by most TLS implementors following its public announcement, a new variant, the Lucky Thirteen attack, published in 2013, used a timing side-channel to re-open the vulnerability even in implementations that had previously been fixed. As of early 2014, the attack is no longer considered a threat in real-life operation, though it is still workable in theory (see signal-to-noise ratio) against a certain class of machines. As of 2015, the most active area of development for attacks upon cryptographic protocols used to secure Internet traffic are downgrade attack, such as Logjam[9] and Export RSA/FREAK[10] attacks, which trick clients in to using less-secure cryptographic operations provided for compatibility with legacy clients when more secure ones are available. An interesting attack called POODLE[11] (late 2014) combines both a downgrade attack (to SSL 3.0) with a padding oracle attack on the older, insecure protocol to enable compromise of the transmitted data. In May 2016 it has been revealed in CVE-2016-2107 that the fix against Lucky Thirteen in OpenSSL introduced another padding oracle.[12][13]

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.. For further information see https://www.weakdh.org.
  10. Lua error in package.lua at line 80: module 'strict' not found.; see https://www.freakattack.com for more information.
  11. Lua error in package.lua at line 80: module 'strict' not found.; for further information, see https://www.poodle.io
  12. Lua error in package.lua at line 80: module 'strict' not found.
  13. Lua error in package.lua at line 80: module 'strict' not found.


<templatestyles src="Asbox/styles.css"></templatestyles>