ABCTF Frozen Recursion - Reverse Engineering 250 Writeup

Well, I played few hours in this 7 days long CTF and I managed to solve some tasks and collect 2020 points :D Following is quick and dirty writeup for "Frozen Recursion" task. The idea of the task was embedding one binary file in another. When you run recursive_python it dumps a new binary file, changes its access permissions, execute it,and finally remove it. The dumped binary do the same steps and so on until having a binary which just prints "You wish it was that easy!" on the screen.  My idea to solve the task was simple. It consist of breaking on chmod function (before deletion)  at each step and analyze the dumped binary and figuring out if it contains the flag.

# gdb recursive_python
gdb-peda$ break chmod
gdb-peda$ r
gdb-peda$ shell
#chmod +x unstep_84fc2d39
#gdb unstep_84fc2d39
gdb-peda$ b chmod
gdb-peda$ r
gdb-peda$ shell
# chmod +x unstep_34a4d33b
# gdb unstep_34a4d33b
gdb-peda$ break chmod
gdb-peda$ r
gdb-peda$ shell
#chmod +x unstep_579c82e9
#gdb unstep_579c82e9
gdb-peda$ break chmod
gdb-peda$ r
gdb-peda$ shell
# chmod +x unstep_f67baaeb
# gdb unstep_f67baaeb
gdb-peda$ start
gdb-peda$ find flag
unstep_f67baaeb : 0x8693c3 ("flag{python_taken_2_far}s\032")



The flag is flag{python_taken_2_far}

The task can be solved statically also by just looking at all base64 strings and decode them (huge file binary ?)

Cheers ;)