0

I'm supposed to write a script that will get the plaintext of a message which is firstly coded in base64, then URL coded (encoded ciphertext in AES-256-CBC). Padding is used as well such that the encoded message is a multiple of the block size.

The message is this: NkivYeRHPWDYVIG%2FgiptBDFmFe%2FWzZA9a9wFuMmuWL%2B6u7FUCZ40Xk4S13CndK1ZlCCvIhwmp%2BDyH58fxDptFA%3D%3D

If I type this in a specific site (server), I get certain messages (for example if padding is invalid / valid, bad request if the length is wrong,..).

But I don't know how I shall use padding oracle attack on this to find the plaintext. I don't care about the program at all, I just like to understand it first.

So I would start by decoding the message such that I just have it in base64:

NkivYeRHPWDYVIG/giptBDFmFe/WzZA9a9wFuMmuWL+6u7FUCZ40Xk4S13CndK1ZlCCvIhwmp+DyH58fxDptFA==

And at this part I'm not sure how to continue or rather say start the padding oracle attack. I think I need to start at the very last block, very last byte and go back. So begin with 0x01 at the end and see if the server gives a valid padding result? Would I need to remove the first two "=" chracters? I don't think so because they are part of the base64, so rather start by removing FA instead and replace with 01?

I hope you can give me some hints really I have checked so many site and books but there isn't as much information as I imagined :/

I'm far away from writing a script for that but I just like to understand it at least.

  • 1
    01 in base64 is very different from 01 in hex, it might help you to convert it to hex when manipulating it, then back to base64 to send to the oracle. – AndrolGenhald Jun 6 '18 at 21:06
  • @AndrolGenhald Thank you! And replace it with the very last byte, so in this case == ? Or will I need to take "FA" ? Because I think these "=" symbols are a must in base64 so I shouldn't change them, you know? – roblind Jun 6 '18 at 21:09
  • 1
    When I say "convert it to hex" I mean decode the base64 and then re-encode it in hex. It sounds to me like you may need to read up on how encoding works, the wikipedia page on base64 may be a good start. – AndrolGenhald Jun 6 '18 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.