Home
Writeups Misc About
Paper Plane

Paper Plane

The description is mentioning something about Infinite Garble Extension, which is used in Telegram (searching the name of the Python class, aesige), hence the name "Paper Plane" - Telegram's logo.

The only observation needed to solve this challenge is that, decryption on a single block can be done without including the entire ciphertext. We only need the first block of ciphertext, and the m0 and c0 corresponding to that block. The very first block will have m0 and c0 provided, and consequent blocks will use the previous plaintext block decrypted for m0, and its corresponding ciphertext block for c0.

Otherwise, this is similar to a padding oracle attack. Only the message that "The message is received" will be returned, and other incorrectly padded messages will return an error. Hence, we can use the technique from CBC Padding Oracle Attack - a classic in any Introduction to Cryptography course in university.

Some implementations on Cryptohack do not work, and this is because of the fact that for the padding, xor the padding with the null byte \x00 is a bad idea - you cannot retrieve any information about the padding with the null byte. You can verify this using a local test with the given code:

Two values for the padding will pop up, one is \x01 and one is \x05. \x05 is the proper padding here, and you should get the idea why xor null byte is a bad idea. This took me a lot of time to figure out, and I actually solve the challenge by guessing out the flag after getting the first block (a legit strategy).

I have rectified the script after guessing out the flag, and identify the problem of using \x00 for the guessing the first byte. Also in the solution a bunch of b'\n' will show up, as Python tries to convert the byte into some ASCII-friendly representation.

Python Implementation: