After this patch it successfully decrypted the TLS session and I got the flag.
KT’s notes
Wireshark did not recognised the SSL stream for me by default, so I had to use the Decode As… > SSL option to make this work.
While NGG patched the Wireshark, I used Bouncy Castle to generate the master secret from the pre-master secret as Wireshark could decode the packet by using the master secret (but NOT with the pre master secret).
But I had to use the new PRF function which is used by TLS v1.2, the SHA256 one. I first tried to use the legacy (MD5+SHA1) one which did not work of course.
The decrypted stream was gziped too, so I had to decompress it manually.
Here is my python code to calculate the pre master secret from the private key primes (provided by NGG):
And this is my C# code to calculate the master secret from the premaster secret:
Setting this file in File > Preferences > Protocols > SSL as the (Pre)-Master-Secret log filename I could follow the SSL with the unpatched Wireshark too:
After decompressing the HTTP response body I got the file’s content:
A website showed the world map, clicking on your country (depending on your IP) gave you a part of the flag:
Clicking on other country said you cannot do that:
Solution was: using a few proxies, TOR, Hola VPN, etc the gather the 6 parts of the flag and then figure out in which order should we concatenate them (from the 6! = 720 possibilites). We know that the SHA256(SHA256(“ASIS{…}”)) hash should match with the hash of the real flag (which was used by the ASIS scoreboard in a client-side javascript code).
Usually on every ASIS CTF we have to use this trick, so if you haven’t know it yet, then don’t forget for next year. :)
Fake was a fairly simple binary. You had to supply a 64 bit integer in decimal form as argv[1] and it multiplied with different values, shifted some and printed out as ASCII.
As we could suspect that the output is the flag (it was 40 bytes long instead of the 38 byte + null terminating zero), and the flag is starting with “ASIS{“ + 3 hex digit (0-9a-f), we would easily bruteforce the solution as there are only 16**3 = 4096 possibilities.
The only problem we had to solve is it multiplied two 64 bit integers, which caused overflow. So when we calculated the input value, we had to solve a very basic congruence.
This C# snippet generated every possible inputs:
Testing them was done by the following bash script: