Padding Oracle Attack
A cryptographic attack exploiting information leaked through error messages about padding validity, enabling decryption without knowing the key.
Padding Oracle Attack exploits applications that reveal whether decrypted data has valid padding. By observing different error responses, attackers can decrypt ciphertext byte-by-byte without knowing the encryption key.
How It Works
Block ciphers in CBC mode require padding (usually PKCS#7) to fill incomplete blocks. If an application returns different errors for "invalid padding" vs "invalid data," attackers can use this oracle to decrypt any ciphertext.
Real-World Examples
- ASP.NET Padding Oracle (CVE-2010-3332)
- Ruby on Rails session cookies
- Java Server Faces ViewState
Prevention
- Use authenticated encryption (AES-GCM) instead of CBC
- Return identical errors for all decryption failures
- Use HMAC to verify ciphertext integrity before decryption
- Implement constant-time comparison