Skip to main content
Challenges CBC padding oracle
Cryptography Hard Oracle attacks Solves: 10

CBC padding oracle

Author: CyberSamSU
Points
110

This is one of the most famous attacks in cryptography. The server decrypts the ciphertext and returns a different error if the PKCS#7 padding is incorrect. This single bit of information ("is the padding correct?") is enough to recover the entire message.

Note — for PKCS#7 padding to be correct, the last byte must be v (1..16) and the last v bytes must be exactly equal to v.

We have a single-block ciphertext: C1, and its IV. Decryption: P = D(K, C1) XOR IV. Here we call I = D(K, C1) the intermediate value — it does not depend on the IV at all!

IV = 83eb6a67d0b7b499635a3223f0f2cefc
C1 = 9dcb38a36ee45bd1f9f6a8272430685c

The attack works in the following order (starting from the last byte):

  1. j = 15, P = 16 - j = 1. We construct IV' like this: all bytes before j are 0x00, IV'[j] = g, the bytes after it are IV'[k] = I[k] XOR P (if they are not found yet, there are no subsequent bytes at this step).
  2. We test g from 0 to 255. For the single g where the oracle says "padding is correct", the last byte was equal to P, therefore I[j] = g XOR P.
  3. We decrease j by one, P = 16 - j increases and the above step is repeated (now the subsequent bytes are padded using the already known I[k]).
  4. Once all 16 bytes are found: P = I XOR IV (with the real IV).

There is no live server — the responses to all 4096 requests are pre-fetched and written to the oracle_javoblari.json file. The key is the SHA-256 hex hash of the 16 bytes of IV', the value is true (padding is correct) or false.

The recovered plaintext will have PKCS#7 padding at the end — remove it and put the remaining text into the flag:

BAYROQ{A3S_<ochiq matn>}

The table contains only the exact requests described above (with 0x00 in place of unfound bytes). If you construct a different IV', you will not find it in the table.

Attached files
oracle_javoblari.json Log in to download
SHA-256 checksums
oracle_javoblari.json: bd27e17a4cf85170e2ce37972ed10a9bd069bcf48323f7731d2170f2488c80b2
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −11 pts Log in
Hint 2 −22 pts Log in
Hint 3 −33 pts Log in
To submit a flag, log in.

First solvers

1. Stiv_084100 10.09.2026
2. W.o.X 17.09.2026
3. Лазиз 01.10.2026
4. testrejim 09.10.2026
5. Farruh Qorjovov 12.10.2026
6. Mirjaxon Qaxxarov 26.10.2026
7. Odam 04.11.2026
8. arcanum 11.11.2026
9. Furqat Turayev 11.11.2026
10. 𝖛𝖊𝖑𝖐𝖆𝖓 28.11.2026