当前位置:网站首页>win32:堆破坏的dump文件分析
win32:堆破坏的dump文件分析
2022-07-03 17:50: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) 从最后一个尚未被破坏的块找到相应的信息。(如果业务逻辑是从小往大地址写,就会破坏往后块,否则就是相反)
边栏推荐
- 自动渗透测试工具核心功能简述
- 互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
- Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
- [combinatorics] generating function (summation property)
- Talk about the design and implementation logic of payment process
- 聊聊支付流程的设计与实现逻辑
- Kotlin的协程:上下文
- Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
- Analyse ArrayList 3: suppression d'éléments
- WEB-UI自动化测试-最全元素定位方法
猜你喜欢

Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)

Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition

QT adjust win screen brightness and sound size

Talk about the design and implementation logic of payment process

Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
![How to read the source code [debug and observe the source code]](/img/40/a2fca67bcde3c468a739c6990325f4.jpg)
How to read the source code [debug and observe the source code]

微服务组件Sentinel控制台调用

Vs2013 has blocked the installer, and ie10 needs to be installed

Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028

鸿蒙第四次培训
随机推荐
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
Inheritance of ES6 class
QT学习日记9——对话框
i++与++i的区别:通俗易懂的讲述他们的区别
1164 Good in C
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.
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
Kotlin的协程:上下文
The gbase 8A database does not support the DB2 function value (column_name, 0) cluster syntax
IntelliJ 2021.3 short command line when running applications
How to read the source code [debug and observe the source code]
[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
PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
UE4 official charging resources, with a total price of several thousand
The difference between i++ and ++i: tell their differences easily
Leetcode Valentine's Day Special - looking for a single dog
ArrayList analysis 3: delete elements
Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028
AcWing 4489. 最长子序列