攻防世界 Pwn Recho

本文介绍PwnRecho1题目的详细解题过程,包括利用alarm函数劫持got表,通过syscall读取并输出flag,展示了ROP链条构造及pwntools的使用。

1.题目下载地址

点击下载

2.checksec

在这里插入图片描述

3.IDA分析

在这里插入图片描述
可以看到这个while是死循环
所以要学会使用pwntools的shutdown功能来退出循环
但是循环退出之后就不能再进入了
接下来要看一下漏洞在哪
在这里插入图片描述

这个题目有个明显后门,在data段发现有flag。可以将它read到bss段中,再通过write输出出来
在gdb动态调试时,分析alarm,发现有
在这里插入图片描述
有syscall系统调用
漏洞利用思路如下:

    1. alrm函数got表劫持到syscall位置
    1. open(‘flag’,READONLY)
    1. 通过read将flag写入到bss段,之后再write输出

ROP链条:
syscall>>flag>>read>>write
ROP地址

└─$ ROPgadget --binary ./Recho --only 'pop|ret'                                                                                              148 ⨯ 1 ⚙
Gadgets information
============================================================
0x000000000040089c : pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x000000000040089e : pop r13 ; pop r14 ; pop r15 ; ret
0x00000000004008a0 : pop r14 ; pop r15 ; ret
0x00000000004008a2 : pop r15 ; ret
0x00000000004006fc : pop rax ; ret <--------------------
0x000000000040089b : pop rbp ; pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret
0x000000000040089f : pop rbp ; pop r14 ; pop r15 ; ret
0x0000000000400690 : pop rbp ; ret
0x00000000004008a3 : pop rdi ; ret   <-----------------------
0x00000000004006fe : pop rdx ; ret   <------------------------
0x00000000004008a1 : pop rsi ; pop r15 ; ret          <---------------------
0x000000000040089d : pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret
0x00000000004005b6 : ret

Unique gadgets found: 13

└─$ ROPgadget --binary ./Recho --only 'add|ret'                                                        
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

==Microsoft==

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值