2
$\begingroup$

This is for a challenge at followthewhiterabbit.trustpilot.com:

Knowns:

  • The algorithm is AES (Rijndael)
  • Blocksize: 128
  • Keysize: 256
  • You only need to find the first 6 bytes of the key, the rest are 0’s, so: [?,?,?,?,?,?,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  • All bytes in the key has an integer value between 0 and 16.
  • The initialization vector is (base64 encoded): "DkBbcmQo1QH+ed1wTyBynA=="
  • The text is just plain ASCII english

The encrypted text (base64 encoded):

[base 64 block follows]

Can I crack an AES string if I have all these parameters? If so, how should I do it?

$\endgroup$
13
  • 6
    $\begingroup$ Only 16 million keys to try so you can use brute force. Guess a key, decode, see if it's text (e.g. high bits zero). $\endgroup$
    – otus
    Commented Jul 16, 2014 at 14:50
  • 2
    $\begingroup$ Just write a loop, try to decrypt, if it decrypted successfully, you have the correct key. $\endgroup$
    – Matthew
    Commented Jul 16, 2014 at 14:59
  • 3
    $\begingroup$ @Matthew ... and verify that the result is correct by doing statistical analysis. Remember that AES decryption with incorrect keys just gets you a bunch of incorrect plaintext bytes. $\endgroup$
    – Polynomial
    Commented Jul 16, 2014 at 19:38
  • 2
    $\begingroup$ Just asking -- is this a public challenge? If so, can you provide a link to it? $\endgroup$ Commented Jul 17, 2014 at 7:12
  • 3
    $\begingroup$ @owlstead: Finally I got it. SHA1 is 20d96d3da31c20171d210acb2186b763b7973f30. There is a small lie in the challenge text. $\endgroup$ Commented Jul 18, 2014 at 15:27

2 Answers 2

5
$\begingroup$

Since there are only $16^6 \approx 16.8$ million keys, you can try them all and decrypt the message with each. In general you would have to know something about the plaintext to identify which of those decrypted candidates is the correct one.

In this case it is known that the message is English ASCII, so the top bit of each plaintext byte will be 0. The chance of an $n$-byte message succeeding that test by chance is $2^{-n}$, so with more than 24 bytes of data (as you have) it is likely you will find a unique key that decrypts it into ASCII. The padding could include a 1 bit, so you might want to ignore the last block until you've found the key.

Remember to try different modes of operation if the first doesn't work – there is an IV, so it isn't ECB. If the ciphertext length was not a multiple of the block size, it would likely be CTR mode, but yours is.

$\endgroup$
1
  • $\begingroup$ Actually, reading the challenge again, there are technically $17^6$ possible keys if you take "between 0 and 16" to include both ends or $15^6$ if you take it to include neither. Just a factor of two difference, so either is doable just fine. $\endgroup$
    – otus
    Commented Sep 6, 2014 at 7:23
0
$\begingroup$

Yes It is crack-able. I did it. Using a programming language I developed a tool to crack this challenge and retrieved the original message. It took about ~2 hours to crack only on an Intel Core 2 Quad Core CPU I don't remember if I dedicated all the resources to the cracking process.

My algorithm was simple:

1. #1: Generate the 6 bytes AES Key and pad it with 0 x 250 2. Decrypt the message and look for the world Congratulations 3. If found print message and quit if not go to #1

Note: I don't think you're allowed to post the challenge online because this violates their copy rights.

$\endgroup$
2
  • $\begingroup$ Re: copyright, quotes are generally fair use, although the one here is a bit excessive in length. I'll trim it a bit. $\endgroup$
    – otus
    Commented Sep 6, 2014 at 7:26
  • $\begingroup$ "pad it with 0 x 250" that part makes no sense considering AES only supports 256 bit/32 byte keys, not 256 byte keys. Perhaps you were using an implementation that ignores additional 0 bytes, so only 0 x 26 were used. $\endgroup$ Commented Sep 6, 2014 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.