Hello I am Arsalan. Offensive Security Engineer, I blog about Cyber security, CTF writeup, Programming, Blockchain and more about tech. born and raised in indonesia, currently living in indonesia
this article explains about SigReturn Oriented Programming.
#Secure-ROP
this is a writeup for Secure-ROP Rooters ctf 2019. we are given a 64-bit elf binary
the binary have 2 function
_start:
and sub_401000():
it have buffer overflow vulnerability, size of buf is 128 bytes but the binary
can read 0x400 or 1024 bytes,
the offset to overwrite rip is 136 bytes , firstly we have to find some gadget
i will use ropper to find all the gadget we need
0x0000000000401032: pop rax; syscall;
0x0000000000401033: syscall; leave; ret;
0x000000000040101f: syscall;
in order to triggering srop we have to set rax to 0xf , first part of our exploit
will look like this
why 0xf ? because 0xf is linux syscall for sys_rt_sigreturn. to make it easy i use
pwntools and create the payload using SigreturnFrame to set some register value
that will make another read with 0x400 size and will be stored a rw segment, i use .data segment
0x0000000000402000 now lets send “/bin/sh” to .data and the offset to the new buffer is
different from the first one , so we have to figure out the offset first. and use another srop
to call sys_execve
after we sent /bin/sh to our new buffer. now we have to do srop to call sys_execve
this is the last part of our exploit