A 'simple' RE problem
http://pwnable.kr/play.php then click the flag
- The game provide only a binary file and a one line cule:
- "Papa brought me a packed present! let's open it.".
- You need to find a flag from the bin file.
0x01 Things Learned from the Solution
(Little leak about the solution)
$ file <filename>
$ file flagwill print the information of the binary file As you can see, this file is stripped, means it might be compressed by some packing tools.
$ strings <filename>
$ strings flagwill search and print all the strings inside the binary file.
$ strings -n 10 flagprints strings containing at least 10 bytes.
$ strings flag | lesswill open the result within less, which allow you to view the result with vim cmd.
0x02 Things Learned from the solution
(Heavy leak about the solution)
To avoid leak too much info about the solution to someone who do not want to know, I didn't use the upx as the subtitle, but this game uses upx to pack and unpack the binary. This could be deduced from the result of
$ strings flag if you've tried.
r2 and try
After unpacked the binary with upx, you can r2 it and the main function will be avaliable which is not before the unpacking.
In the main function, you should be able to recognize the malloc() as well as the word flag:
You might have already see the flag sentence thanks to the word 'UPX'. So you back to the bash and type:
$ strings flag | grep -i upx
That's it, you know this is a flag because.. it really looks like a flag.