Crypto – AES-ABC

AES-ABC - 400pt

Challenge

AES-ECB is bad, so I rolled my own cipher block chaining mechanism - Addition Block Chaining! You can find the source here: aes-abc.py. The AES-ABC flag is body.enc.ppm

Hints

You probably want to figure out what the flag looks like in ECB form...

Solution

The key to solve this challenge is to notice that the custom algorithm is applied over the AES-EBC encryption of the original image. The weakness of this algorithm is that it encrypts the byte strings in input only considering their value. This means that every byte string having value <code>x</code><code> will be encrypted to </code><code>y = enc(x)</code>.\
In the case of an image, this can be particularly useful because it's pretty likely that the contours of the shapes in the encrypted result will still be clearly distinguishable.
Since the encoding is based on a cumulative sum, the decoding will have to use a cumulative subtraction.\
The first chunk of the encrypted data is left unchanged. This means that it is common for both the plain and the cipher data. Plus, every chunk is obtained by summing the others, therefore the last chunk contains the sum (even if mod UMAX) of all of the chunks of the plain image.\
To reverse this, we can simply update every element with the difference of itself and the element before it. It's important to remember that, since in the encryption algorithm all of the operations were mod UMAX, this will have to be replicated in the decryption procedure. The combination of the data outputted by this algorithm with the PPM header will generate an AES-EBC encryption of the flag, where said flag can be read.

<code>picoCTF{d0Nt_r0ll_yoUr_0wN_aES}</code>

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *