Unknown
200
Diggin through some old files we discovered this binary. Although despite our inspection we can’t figure out what it does. Or what it wants…
unknown - md5: 9f08f6e8240d4a0e098c4065c5737ca6
Reversing the binary
The binary has the following restrictions, we need to provide the correct flag as argv[1]
and the length of the flag must have 56 of length as we can see bellow in the assembly:
After this initial checks we are going to have a loop that checks each byte of the flag provided using a big encryption function fcn.00401e90
, we can easily check if the byte is correct or not by checking the value of RAX
after the function returns as it is explained in the image below:
Radare2 Script
We don’t really need to reverse the encryption function fcn.00401e90
, since we can write a radare2 script that checks the return values(RAX
) from this function we can just brute-force the flag byte by byte, we need to update the address where the string is stored at each iteration/tentative, and in failed attempts we need to decrement the counter of the loop so we can recheck the same flag byte, this can be done with a script like this:
1 | import r2pipe |
Running it:
1 | $ python unknown.py |