Toko Buku
Binary Exploitation/Pwn (heap challenge)

Given an ELF file, when we run it:

As the name suggests, it is a bookstore program. We can see here the binary has a full protection, which implies that maybe this is a heap challenge. We proceed to decompile it using ida and got these functions:
main:
Sub_1277 (menu):
Sub_12D6 (Masukkan buku):
Sub_1419 (Buang buku):
Sub_14F7 (Lihat judul):
Sub_15AE (ganti buku):
From these functions we get a few vulns like UAF cause the pointer is not nulled after freed, Heap overflow via scanf, leak unsorted-bin.
So the exploit flow: allocate a large chunk -> free the chunk to get into unsorted bin -> show the chunk to leak the unsorted bin pointer -> get libc base from the leaked address -> then allocate two chunks then free it -> UAF write to overwrite the fd to __free_hook address -> malloc two times, the second malloc should give us the __free_hook pointer -> write system to __free_hook -> trigger it by allocating a chunk with /bin/sh\x00 in it, then free the chunk
solver.py:
When we run it, we get the flag:

Flag: WRECKIT60{t0k0_buku_1t01d_m4nt4p_s3k4l111!!!!!_h4h4h4h4h4}
Last updated