Investigative Reversing 1
Last updated
Was this helpful?
Last updated
Was this helpful?
We have recovered a binary and a few images: image, image2, image3. See what you can make of it. There should be a flag somewhere. Its also found in /problems/investigative-reversing-1_4_266adcde17fa2ab2ec454e6c5379ad81 on the shell server.
Run file mystery
which shows its is a ELF executable: mystery: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld
...
Reverse the binary file using (). Open it and in the symbol tree click on main. The decompiled main function will show on the right.
We can see that the program opens the flag file, and scatters an encoded version of it across the three image files.
The encoding works as follows:
Append byte 1 to file 3
Add 0x15
to byte 0 and append to file 2
Append byte 2 to file 3
Append byte 5 to file 3. At the top of the file the variables are listed like so:
This means that local_34
will contain the 4th character from flag and local_33
will contain the 5th. So in the below lines the 5th bytes is added then the 4th.
Append byte 4 to file 1
Append bytes 6 to 9 (inclusive) to file 1
Append byte 3 (which has been increased by 4 during the above loop) to file 2
Append bytes 10 to 14 (inclusive) to file 3
Append bytes 15 to 25 (inclusive) to file 1
We need to copy the last 16 bytes from file 1, 2 from file 2, and 8 from file 3 to variable data_1
, data_2
, data_3
in the , which reverses the scheme explained above.
We can reverse this using the and get the flag.
picoCTF{An0tha_1_855611d3}