当前位置:网站首页>win32:堆破壞的dump文件分析
win32:堆破壞的dump文件分析
2022-07-03 17:52:00 【修的什麼真】
- win32堆結構
在解决實際問題以前,先來了解一下相關概念
1. 堆結構
堆->段->塊
堆是由段,段是由塊組成的,塊就是用戶最終向系統申請的虛擬內存的數據結構。(目前我們用戶態程序只需要理解塊就可以了)
2. _HEAP_ENTRY結構
每個堆,每個段,每個塊都會有相應的_HEAP_ENTRY結構,裏面描述了該區域內容的信息。比如塊的_HEAP_ENTRY結構就存放了所屬的堆,段,前項大小和當前大小等信息。
- windbg堆的相關命令
- 查看所有堆的概覽信息:!heap -s
- 某個堆所有的段和塊信息:!heap -a 0xXXXXXXXX
- 查看某個內存地址所在的_HEAP_ENTRY信息:!heap -x 0xXXXXXXXX
- 統計某個堆的概覽信息:!heap -stat -h 0xXXXXXXXX
- 列出所有大小為X的塊地址:!heap -flt s X
- 查看堆的調試支持:!gflag
- 查看內存塊的內容 dc 0xXXXXXXXX
- 堆破壞的調試
1. 什麼叫做堆破壞
堆破壞其實就是塊破壞,由於對超出地址所在分配的空間讀寫,導致破壞了_HEAP_ENTRY結構(如果是CRT堆,就是破壞了CRT堆的末尾檢查結構,甚至破壞了下一個塊的結構)
2. 一個堆破壞的例子
這裏故意寫了一個越界的操作,編譯成release版本,用windbg掛上去
查看一下ptr的值
查看一下ptr所在的_HEAP_ENTRY結構,發現屬於00b30000這個堆,在00b34420這個塊裏面
我們看到上述塊後續的塊都已經被破壞,所以堆破壞的特征基本就長這樣。但是該例程並不會導致崩潰。
3. 總結一下分析思路
a) 找到該崩潰的塊所在的堆(可以根據地址範圍判斷)。
b) 查看該堆所有塊信息。
c) 從最後一個尚未被破壞的塊找到相應的信息。(如果業務邏輯是從小往大地址寫,就會破壞往後塊,否則就是相反)
边栏推荐
- [LINUX]CentOS 7 安装MYSQL时报错“No package mysql-server available“No package zabbix-server-mysql availabl
- 【统信UOS】扫描仪设备管理驱动安装
- Supervisor monitors gearman tasks
- 模块九作业
- [combinatorics] generating function (linear property | product property)
- Research on Swift
- 一入“远程”终不悔,几人欢喜几人愁。| 社区征文
- Detailed explanation of common network attacks
- (9) Opencv Canny edge detection
- A. Berland Poker &1000【简单数学思维】
猜你喜欢
问题随记 —— 在 edge 上看视频会绿屏
Deops入门
Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
STM32 realizes 74HC595 control
聊聊支付流程的设计与实现逻辑
Notes on problems -- watching videos on edge will make the screen green
Hongmeng third training
TensorBoard快速入门(Pytorch使用TensorBoard)
POM in idea XML graying solution
Applet setting multi account debugging
随机推荐
Graduation summary
A. Odd Selection【BruteForce】
Embedded-c language-7
SSL / bio pour OpenSSL Get FD
Micro service component sentinel console call
(9) Opencv Canny edge detection
Kotlin's collaboration: Context
STM32实现74HC595控制
As soon as we enter "remote", we will never regret, and several people will be happy and several people will be sad| Community essay solicitation
Notes on problems -- watching videos on edge will make the screen green
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
Servlet specification Part II
[combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Write a program to process a list container of string type. Find a special value in the container 9.27: and delete it if found. Rewrite the above procedure with deque container.
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
STM32 realizes 74HC595 control
Postfix 技巧和故障排除命令
Interviewer: why is the value nil not equal to nil?
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th