Investigative Reversing 0
Last updated
Was this helpful?
Last updated
Was this helpful?
We have recovered a binary and an image. See what you can make of it. There should be a flag somewhere. Its also found in /problems/investigative-reversing-0_4_950a47cfcfc9b661c36603148c77df3d 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 places an encoded version of it at the end of the image file.
The encoding works as follows:
Add bytes 0 to 5 (inclusive) to the image.
Loop through the bytes of the flag from 6 to 0xf
(from 6 to 14, inclusive) and add '\x05'
(5) to each bytes.
Add the 15th byte minus 3 (probably the 15th byte, I am assuming based on the code structure).
Loop through and add the remaining bytes (16 to 25, inclusive).
We can reverse this using the and get the flag.
picoCTF{f0und_1t_5266a857}