ArticleslgStudy

computer science

Padding oracle attack

Padding oracle attack is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Padding oracle attack rather than just read about it. In short: In cryptography, a padding oracle attack is an attack which uses the padding validation of a cryptographic message to decrypt the ciphertext. In cryptography, variable-length plaintext messages often have to be padded (expanded) to be compatible with the underlying cryptographic primitive.

Padding oracle attack — main illustration
Padding oracle attack — illustration

Key takeaways

  • Padding oracle attack belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Padding oracle attack to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Padding oracle attack from memory before moving on to harder problems.

Reference excerpt

In cryptography, a padding oracle attack is an attack which uses the padding validation of a cryptographic message to decrypt the ciphertext. 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" which freely responds to queries about whether a message is correctly padded or not. The information could be directly given, or leaked through a side-channel. The earliest well-known attack that uses a padding oracle is Bleichenbacher's attack of 1998, which attacks RSA with PKCS #1 v1.5 padding. The term "padding oracle" appeared in literature in 2002, after Serge Vaudenay's attack on the CBC mode decryption used within symmetric block ciphers. Variants of both attacks continue to find success more than one decade after their original publication.

Asymmetric cryptography In 1998, Daniel Bleichenbacher published a seminal paper on what became known as Bleichenbacher's attack (also known as "million message attack"). The attack uses a padding oracle against RSA with PKCS #1 v1.5 padding, but it does not include the term. Later authors have classified his attack as a padding oracle attack. Manger (2001) reports an attack on the replacement for PKCS #1 v1.5 padding, PKCS #1 v2.0 "OAEP".

Symmetric cryptography In symmetric cryptography, the padding oracle attack can be applied to the CBC mode of operation. Leaked data on padding validity can allow attackers to decrypt (and sometimes encrypt) messages through the oracle using the oracle's key, without knowing the encryption key. Compared to Bleichenbacher's attack on RSA with PKCS #1 v1.5, Vaudenay's attack on CBC is much more efficient. Both attacks target crypto systems commonly used for the time: CBC is the original mode used in Secure Sockets Layer (SSL) and had continued to be supported in TLS. A number of mitigations have been performed to prevent the decryption software from acting as an oracle, but newer attacks based on timing have repeatedly revived this oracle. TLS 1.2 introduces a number of authenticated encryption with additional data modes that do not rely on CBC.

Padding oracle attack on CBC encryption The standard implementation of CBC decryption in block ciphers is to decrypt all ciphertext blocks, validate the padding, remove the PKCS7 padding, and return the message's plaintext. If the server allows an attacker to hand over arbitrary data, the attacker can use the server as a padding oracle to decrypt (and sometimes encrypt) messages. The only way to prevent this attack is to make sure that the attacker cannot manipulate the data handed over to the algorithm, e.g. by only accepting messages which are secured with a digital signature or message authentication code which the attacker cannot forge.

The mathematical formula for CBC decryption is

P i = D K ( C i ) ⊕ C i − 1 , if i ∈ { 1 , N } {\displaystyle P_{i}=D_{K}(C_{i})\oplus C_{i-1},{\text{ if }}i\in \{1,N\}}

P 0 = I V ⊕ D K ( C 0 ) . {\displaystyle P_{0}=IV\oplus D_{K}(C_{0}).}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Padding oracle attack

Start with the simplest possible case. Write down what Padding oracle attack claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Padding oracle attack before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Padding oracle attack ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Padding oracle attack

In research
Padding oracle attack appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Padding oracle attack in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Padding oracle attack is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computation oracles, Cryptographic attacks, Transport Layer Security, so understanding it makes those chapters shorter.
In everyday life
Look for Padding oracle attack outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Padding oracle attack in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Padding oracle attack means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Padding oracle attack out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Padding oracle attack in simple terms?

In cryptography, a padding oracle attack is an attack which uses the padding validation of a cryptographic message to decrypt the ciphertext. In cryptography, variable-length plaintext messages often have to be padded (expanded) to be compatible with the underlying cryptographic primitive.

Why does Padding oracle attack matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Padding oracle attack?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Padding oracle attack.

Tags

  • Computation oracles
  • Cryptographic attacks
  • Transport Layer Security

Keep exploring