# TAMUctf - Mike's Marvelous Mistery Curves Writeup

## Challenge description

Mike, the System Administrator, thought it would be a good idea to implement his own Elliptic Curve Diffie Hellman key exchange using unnamed curves to use across the network. We managed to capture network traffic of the key exchange along with an encrypted file transfer. See if you can read the contents of that file.

Note: The password to the AES192-CBC encrypted file is the shared key x and y coordinates from the key exchange concatenated together. (e.g. sharedKey = (12345,67890) password = “1234567890”)

Difficulty: hard

Edit: 02/23/2019 14:33 Changed AES256-CBC to AES192-CBC

## Solution

The file we have is key_exchange.pcap. Here we can find three streams: the two certificates and the encrypted file. For example, one of the certificates is the following:

which, decoded as base64, is:

So we have the elliptic curve’s parameters:

Alice’s public key:

Bob’s public key:

So, I tried to break these keys using Baby step - Giant step algorithm, and it worked! Here is the code:

and the output is:

so the AES key is 130222573707242246159397.

Now, the hardest part (for me) was to extract the AES-encrypted file from the pcap file. After several attempts, I managed to have my copy of that file. With the following script I decrypted the file:

In out.txt there was a passage from The Hitchhiker's Guide to the Galaxy with the flag gigem{Forty-two_said_Deep_Thought}.