Writeup: EBCTF 2013 - Espionage
Information
- Category: crypto
Description
We suspect an employee of one of the embassies has leaked
confidential information to a foreign intelligence agency.
We’ve managed to capture an individual whom we assume to
be the recipient of the info. Our forensics department has
managed to recover two messages from his outbox, which
appear to be encrypted using some crypto tool. Along with
each email our suspect also received an SMS message
containing a password, however we were only able to recover
one - “SieR1mephad7oose”.
Could you help us decrypt both messages?
Files:
1 | cry100_espionage.tar.gz |
Writeup
The challenge offers a python script used for encryption and decryption.
The crypt process performs a block-cipher, using a different key for each block:
1 | def crypt(msg, passwd): |
However, unlikely a secure block cipher, this algorithm doesn’t perform some kind of message permutation and we can exploit this as an entry point.
The first decrypted message (using the script and the key given by the admins) is:
1 | From: Vlugge Japie <vl.japie@yahoo.com> |
We can safely assume that the second message has the same header of the first.
So by xoring the first 16 bytes of the encoded message with "From: Vlugge Jap"
, we obtain the key of the first message block.
The rest of the key can be obtained automatically.
1 | os.system("./crypto.py decrypt SieR1mephad7oose msg001.enc msg001.res") |
Result:
1 | From: Vlugge Japie <vl.japie@yahoo.com> |
Done :)
Flag
1 | ebCTF{21bbc4f404fa2057cde2adbf864b5481} |