当前位置:网站首页>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) 從最後一個尚未被破壞的塊找到相應的信息。(如果業務邏輯是從小往大地址寫,就會破壞往後塊,否則就是相反)
边栏推荐
- 国内如何购买Google Colab会员
- link preload prefetch
- Records of long objects and long judgments in the stream of list
- Five problems of database operation in commodity supermarket system
- STM32 realizes 74HC595 control
- Graduation summary
- Distributed task distribution framework gearman
- Automata and automatic line of non-standard design
- Embedded-c language-7
- TCP congestion control details | 3 design space
猜你喜欢
TCP拥塞控制详解 | 3. 设计空间
Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
Micro service component sentinel console call
1164 Good in C
鸿蒙第四次培训
List的stream中Long对象与long判等问题记录
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
Leetcode Valentine's Day Special - looking for a single dog
Research on Swift
随机推荐
SDNUOJ1015
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
聊聊支付流程的设计与实现逻辑
互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
link preload prefetch
Stm32h7 Hal library SPI DMA transmission has been in busy solution
鸿蒙第四次培训
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
AcWing 4489. 最长子序列
Design limitations of structure type (struct)
List of financial products in 2022
WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
Mathematical formula (test)
[combinatorics] recursive equation (case where the non-homogeneous part is exponential | example where the non-homogeneous part is exponential)
List的stream中Long对象与long判等问题记录
Getting started with deops
Where is the monitoring page of RDS database?
Fedora 21 安装 LAMP 主机服务器
Qt调节Win屏幕亮度和声音大小
Hongmeng third training