Played with Friendly Maltese Citizens and came first in this ctf. I just spent some time solve merger-2077 since last weekend were work days for me. Learning game hacks from scratch in such a short time is challenging. Glad that we managed to solve it.
Scoreboard
Challenge Info
First Look
Decompress the apk file and take a first look at the structure.
It’s a unity game and il2cpp reverse, with a japanese metadata file name.
A Failed Try
A common way to solve an il2cpp reverse challenge is find where it load (and decrypt) the metadata.
Since the name is in japanese and hard to identify in IDA, an easy way is to locate ERROR: Could not open %s . The function is long so i will put the code there instead of a pic.
It is easy to identify the decrypt function as blowfish since the constants are not modified. After a carefully analysis, we confirm that it is the blowfish. So we can easily decrypt the metadata and use il2cppdumper to fetch the function and struct information. But things didn’t go as expected. The decrypted metadata has obfuscated header.
The Sanity and version do not appear at the right positions and we fail to recover the header since we got conflicts. So the static way failed.
Final Solution
Use the magisk version of il2cppdumper to dump dynamically. Search dump.cs for Assembly-CSharp.dll and find something interesting.
The class seems to be used to store something with encrypt, decrypt, read and write methods. After hooking and fetching the args of ReadSecretValue and WriteSecretValue with frida, I find that, everytime the score updates, the ReadSecretValue and WriteSecretValue are called with string score as argument, to look up an encrypted dictionary.
After some reverse, I found where the dictionary is decrypted and the length of it.
So, I use frida to hook after the decryption and dump the memory of the dictionary.
Comments