当前位置:网站首页>Stack overflow basic exercise - 5 (string vulnerability)
Stack overflow basic exercise - 5 (string vulnerability)
2022-07-23 06:15:00 【Mokapeng】
Title address : Please have a look at pwn Stack overflow basic exercises ——1 ; Put all the exercise topics of this blog
fmtstr1
List of articles
printf Summary of vulnerability
printf Formatting vulnerability
%s: Take the referred spatial data as the address , Output the data in this address
%p: The address index of the output address itself
%n: Write the number of successful characters in front of the address , And %s similar ,%s Yes. ,%n Yes. , Write four bytes at a time
print(“%p%p%p”) Space call graph of :
"%p%p%p" As printf() The first parameter of , Indicates the format of the output , Because the second parameter is not given , Then it defaults to output up in sequence
When we can control printf() Function parameters , You can easily obtain any data
tips:
print(“%3$d”,a,b,c) 3$ It means to print the third parameter directly , Here for c
adopt printf() Disclose any address flow chart :
When we construct printf(“%p%p%p%p”) when , The address space is :
Findings will be %p%p%p%p Deposit in 0xffffd1bc, And will 0xffffd1bc Address deposit printf() Parameters 1 The location of , So when we will %p%p%p%p When changing to address , Then the address value can be stored in 0xffffd1bc, If we can use %s Format parameters can be 0xffffd1bc Address content as address , Output the value of this address , That means we can go through printf(“ Address values %s”) Class to output the contents stored at any address .
Analysis of exercises

Open the Canary Protect , But the address is not randomized
Put the title in ida
Find a hole printf(&buf), also buf Content by read Function write , Then we can control
- printf(&buf) There is only one parameter
- buf Can be controlled
To sum up, there are printf() Loophole
Obviously, our goal is to x Is set to 4, stay printf() In vulnerability %n Formatting is qualified for writing
Ideas : adopt printf() Loophole , utilize %n take x To change the value of 4
Through the first ida find x The address of , And found x The value is 3
Dynamic debugging , Input AAAAAAAA, And in printf() Check the stack at the function
Our aim is to make 0xffffd070 Place for x The address of , such x The value of the address will be stored 0xffffd09c in , Second, let %n Can control 0xffffd09c The contents of the stored address . Look at the ,0xffffd070 by printf() Function first argument , The following is the format string parameter , namely 0xffffd074 For format string number 1 Parameters ,0xffffd09c It is the first 11 Parameters , And because of x My address is 4 byte ,%n=4, Just meet x=4 The requirements of , So construct printf(“x_addr%11$n”)
Attack code :
from pwn import *
io = process("./fmtstr1")
payload = p32(0x0804A02C) + b"%11$n"
io.send(payload)
io.interactive()
边栏推荐
- 30出头成为复旦博导,陈思明:敲代码和写诗,我两样都要
- Using "hifolw" to quickly create the information generation of College Students' return list
- 2019_ AAAI_ Multi-Interactive Memory Network for Aspect Based Multimodal Sentiment Analysis
- 日常记账后,项目图表显示各种收支类别
- 华为首席开源联络官任旭东:深耕基础软件开源,协同打造数字世界根技术
- 最大公约数和最小公倍数
- Lc: sword finger offer 10- I. Fibonacci series
- Theoretical basis of machine learning
- ROPgadget初识 ——— ret2syscall
- Encoder decoder (seq2seq)
猜你喜欢

堆基础练习题 —— 1

【数据库连接】——节选自培训

2019_AAAI_Multi-Interactive Memory Network for Aspect Based Multimodal Sentiment Analysis

Chapter7 recurrent neural network-2

CSDN陪伴了我四年本科生活,自己也开始好好记录一下啦

2019_AAAI_ICCN

机器学习开发应用步骤的理解

NLP-语言模型

2020_ ACL_ A Transformer-based joint-encoding for Emotion Recognition and Sentiment Analysis

中国电子信息产业发展研究院院长张立:打造我国主导的开源价值链
随机推荐
【基础3】——结构与函数
NLP学习路线图(思维导图),非常的全面和清晰!
关于博主帅soserious的一些感想.
图卷积神经网络(GCN)浅浅析
2019_ IJCAI_ Adapting BERT for Target-Oriented Multimodal Sentiment Classification
Greatest common divisor and least common multiple
Solution of cross domain problems
51单片机的入门知识(献给初学者最易懂的文章)
CSDN has accompanied me for four years of undergraduate life, and I have begun to record it well
2020_ACL_A Transformer-based joint-encoding for Emotion Recognition and Sentiment Analysis
Establishment of zstuacm student information base (completed with linked list)
pwn栈溢出基础练习题——1
Ia note 1
Saisissez une chaîne de caractères à partir du clavier et affichez différents caractères et le nombre d'occurrences de chaque caractère. (la sortie n'est pas séquentielle) résoudre le problème en util
Chapter7 recurrent neural network-2
Win10 系统下VisualStudio2019 配置点云库 PCL1.12.1
Unix programming project - the client based on raspberry pie regularly obtains the temperature and reports it to the server
PWN --- ret2shellcode
DB207-ASEMI整流桥一般用在什么地方,DB207参数尺寸
IDEA:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.