Monday, June 11, 2012

Secuinside CTF 2012 - iu

The challenge text was as follows:

Hints:
1. hex
2. [-3:]
3. inverse.

Challenge text:
-----
the message was decoded:
11111011 11101111 10001110 10000110 00011000 01100001
10000110 00011000 01011000 10100010 11100011 01011010
10111010 00001000 01101101 11001000 00010000 00010010
00010011 10101110 00111110 11111011 10111010 01011110
01100100
-----

As the hints mention, we converted the binary above to hex and got the following:

0000000: fbef 8e86 1861 8618 58a2 e35a ba08 6dc8  .....a..X..Z..m.
0000010: 1012 13ae 3efb ba5e 64                   ....>..^d

The second hint [-3:] means the last 3 elements of an array or last 3 chars in a string in python. The last 3 byes here was ba5e64 which stands for Base64. The challenge hint was also that "this message was decoded" so we need to Base64 encode to get the flag. On encoding, we get:

+++OhhhhhhhYouNaughtyBASE64++7peZA==

However, the above was not accepted as the key. Further hints were given to separately do Base64 of the first 22 bytes and the last 3 bytes and concatenate them to get the key. On doing the same we get the following which is still not the accepted key.

+++OhhhhhhhYouNaughtyBASE64++w== and ul5k

After some guessing, we get the correct key:

+++OhhhhhhhYouNaughtyBASE64+++==ul5k

Because of random padding, it turns out that both "+++OhhhhhhhYouNaughtyBASE64+++==" and "+++OhhhhhhhYouNaughtyBASE64++w==" decode to the same bytes.

No comments:

Post a Comment