Let’s run checksec on the binary and see what protections it has.
quix@quixel:~$ checksec --file=format_pie
RELRO STACK CANARY NX PIE RPATH RUNPATH Symbols FORTIFY Fortified Fortifiable FILE
Partial RELRO Canary found NX enabled PIE enabled No RPATH No RUNPATH 48 Symbols No 0 2 format_pie
- PIE,NX and canary are all enabled.
- Partial RELRO means that we can overwrite a GOT entry.
We can also see that the binary contains a win function that spawns a shell for us: