当前位置:网站首页>Attack and defense world - PWN learning notes
Attack and defense world - PWN learning notes
2022-07-07 12:23:00 【hcjtn】
PWN Learning notes
One , Stack introduction
Stack : Stack is a data structure in computer system , It stores data according to the principle of "first in, second out" , The data entered first is pushed to the bottom of the stack , The last data is at the top of the stack , When you need to read data, pop up the data from the top of the stack ( The last data is read by the first ), It's a special linear table . Stack operation commonly used is stack entry (PUSH), Out of the stack (POP), There are also commonly used marks for the top and bottom of the stack .
Into the stack (PUSH): Putting a data on the stack is called entering the stack (PUSH)
Out of the stack (POP): Take a data out of the stack and call it out of the stack (POP)
To the top of the stack : Common registers ESP,ESP It's a stack pointer register , It has a pointer in its memory , The pointer always points to the top of the top stack frame of the system stack .
At the bottom of the stack : Common registers EBP,EBP Is the base pointer register , It has a pointer in its memory , The pointer always points to the bottom of the top stack frame of the system stack .
Two , Stack overflow
1. Assembly level function call process :
Every call to every function , Each has its own stack frame , All kinds of information needed are maintained in this stack frame . register ebp Point to the bottom of the current stack frame ( High address ), register esp Point to the top of the current stack frame ( Low address ).

Stack overflow : The character length written by the user exceeds the character length of the variable itself, resulting in buffer overflow and rewriting of useful storage units , Write arbitrary data to these units , Generally, it will only lead to accidents such as program crash , But if you write carefully prepared data to these units , It can make our data replace the original code to execute the program , Cause the code we want to be executed .
3、 ... and , Common function

Four , file information
View file information :file
Check the file program :checksec
Arch File attribute
RELEO Bind dynamic symbols to reduce pairs GOT attack
Stack canary stack Protect
NX Unenforceable
PIE Address randomization
Production view header information :readelf-h
function : run
Select File :gdb
Look at the stack data :stack
Check the position of the string :search‘ character string ’
5、 ... and ,ROP
1. Definition :( Baidu )ROP Its full name is Return-oriented Programming( Return oriented programming ) It is a new attack based on code reuse technology , An attacker extracts instruction fragments from an existing library or executable , Build malicious code .ROP Attack the same Buffer overflow attack , Format string vulnerability attacks are different , It's a new way to attack , It uses code reuse technology .
2.ROP Attack prevention :ROP The attack program mainly uses the vulnerability of stack overflow to attack hijacking .
6、 ... and , Pile up
1. Definition :
The memory that needs to be allocated and released when data is running .( Variable size )
2.chunk( Structure of memory block )
chunk start:chunk From
size :chunk Size
memory:malloc Wait for the function to return to the user chunk Data pointer
3.glbic( Heap management )
- arena: Refers to the heap memory area native , Not structure .
- malloc_state: Manage the state of the heap , Information ,bins Linked list
4,bins
- Used to manage free memory blocks , Usually use the linked list structure 0 management
7、 ... and ,Glibc Heap
- Memory allocation is divided into : Dynamic allocation and static allocation .
- ptmalloc data structure
- malloc/free summary
8、 ... and , Formatted string
Concept : In the process of programming , Allow coders to pass special placeholders , The rule string that integrates or extracts the relevant corresponding information .
Format strings are divided into format input and format output .
Common formatting string constants :printf fprintf …
Format string vulnerability summary The user can read the memory by controlling the format string , Modify the memory value ( utilize %n Write to the specified memory address ), The application crashed .
Nine ,PLT and GOT surface
linux The build process : Preprocessing , compile , assembly , link
Dynamic compilation and static compilation
Dynamic compilation features : Avoid the waste of space , But the efficiency of dynamic compilation is lower than that of static compilation .
GOT surface : The real address is stored in the table , Seven fields need to be dynamically modified , It's writable
Library function :stdio,ctype, string etc.
Ten , Common instructions
- see file :file file name
- Check the documents :checksec --file= file name
- Run the file :./ file name
11、 ... and , exp Script
- from pwn import* Import function library ( Application pwn Tools )
- context() Easy to find mistakes
- def main () The main function
- hcj=remote(” “) long-range
- payload= Output data
- hcj.recvuntil(” “) Where to receive
- hcj. sendlineafter(" ",) Execute to which sentence to send a piece of data
- hcj.sendline(" ") Send a piece of data
- hcj.interactive() Accept
Add :gets Functions must be loopholes
Reference list :
https://blog.csdn.net/weixin_43847969/article/details/104390904?spm=1001.2014.3001.5506
https://blog.csdn.net/qq_41988448/article/details/103124339?spm=1001.2014.3001.5506
The rest of the information is from the Internet
边栏推荐
- wallys/Qualcomm IPQ8072A networking SBC supports dual 10GbE, WiFi 6
- Mise en œuvre du codage Huffman et du décodage avec interface graphique par MATLAB
- 消息队列消息丢失和消息重复发送的处理策略
- Tutorial on principles and applications of database system (010) -- exercises of conceptual model and data model
- 111. Network security penetration test - [privilege escalation 9] - [windows 2008 R2 kernel overflow privilege escalation]
- Flet教程之 19 VerticalDivider 分隔符组件 基础入门(教程含源码)
- Have you ever met flick Oracle CDC, read a table without update operation, and read it repeatedly every ten seconds
- Up meta - Web3.0 world innovative meta universe financial agreement
- 2022年在启牛开华泰的账户安全吗?
- EPP+DIS学习之路(2)——Blink!闪烁!
猜你喜欢

2022 8th "certification Cup" China University risk management and control ability challenge

Completion report of communication software development and Application

Mastering the new functions of swiftui 4 weatherkit and swift charts

Tutorial on principles and applications of database system (010) -- exercises of conceptual model and data model

【紋理特征提取】基於matlab局部二值模式LBP圖像紋理特征提取【含Matlab源碼 1931期】

VSCode的学习使用

NPC Jincang was invited to participate in the "aerospace 706" I have an appointment with aerospace computer "national Partner Conference

Matlab implementation of Huffman coding and decoding with GUI interface
![112.网络安全渗透测试—[权限提升篇10]—[Windows 2003 LPK.DDL劫持提权&msf本地提权]](/img/b6/6dfe9be842204567096d1f4292e8e7.png)
112.网络安全渗透测试—[权限提升篇10]—[Windows 2003 LPK.DDL劫持提权&msf本地提权]

Simple network configuration for equipment management
随机推荐
Sonar:Cognitive Complexity认知复杂度
[texture feature extraction] LBP image texture feature extraction based on MATLAB local binary mode [including Matlab source code 1931]
开发一个小程序商城需要多少钱?
Explore cloud database of cloud services together
Have you ever met flick Oracle CDC, read a table without update operation, and read it repeatedly every ten seconds
【神经网络】卷积神经网络CNN【含Matlab源码 1932期】
Xiaohongshu microservice framework and governance and other cloud native business architecture evolution cases
让数字管理好库存
Tutorial on the principle and application of database system (011) -- relational database
【纹理特征提取】基于matlab局部二值模式LBP图像纹理特征提取【含Matlab源码 1931期】
消息队列消息丢失和消息重复发送的处理策略
[filter tracking] strapdown inertial navigation pure inertial navigation solution matlab implementation
Inverted index of ES underlying principle
Unity map auto match material tool map auto add to shader tool shader match map tool map made by substance painter auto match shader tool
112. Network security penetration test - [privilege promotion article 10] - [Windows 2003 lpk.ddl hijacking rights lifting & MSF local rights lifting]
百度数字人度晓晓在线回应网友喊话 应战上海高考英语作文
Sort out the garbage collection of JVM, and don't involve high-quality things such as performance tuning for the time being
Fleet tutorial 15 introduction to GridView Basics (tutorial includes source code)
[shortest circuit] acwing 1127 Sweet butter (heap optimized dijsktra or SPFA)
<No. 9> 1805. 字符串中不同整数的数目 (简单)