当前位置:网站首页>逆向调试入门-PE中的VA与RVA换算04/07
逆向调试入门-PE中的VA与RVA换算04/07
2022-06-30 12:36:00 【51CTO】
区块特点:
1、内存页的属性
2、节的偏移地址
3、节的尺寸
4、不进行映射的节
节事实上就是相同属性数据的组合。

文件与内存映射的关系
公式为
RVA是相对虚拟地址(RelativeVirtualAddress)的缩写。RVA是当PE文件被装载到内存中后,某个数据位置相对于文件头的偏移量。
参考文章:
在实际情况下,我们常常会遇到将代码段中访问的RVA转换成PA,在这种情况下需要读取⽂件头来做相应的转换。

转换过程
转换的⼀般步骤为:
1、将exe⽂件映射⼊内存中,读取Dos MZ Header,在这个结构中,我们能够通过e_lfanew来获取NT⽂件头相对于Dos⽂件头的偏移。

MZ头部

DOS头部相对于PE头部的偏移
2、获取到了NT⽂件头的地址,NT⽂件头中包含了两个⽂件头,⼀个是FILE⽂件头,⼀个是Optional可选⽂件头,在FILE⽂件头中我们可以读取到段的数量,在转换RVA地址的时候,我们只需要得到这个数量。

段的数量为8
3、将NT⽂件头之后紧跟着的就是SECTION TABLE,这是段描述头,在这个段描述头中,我们⼏乎可以获取到全部的段的资料。
VritualAddress: 这个是⼀个RVA地址,代表的意义是告诉PE加载器该段存在于RVA地址为VritualAddress处

VA为1000H
PointerToRawData: 这是⼀个物理偏移地址,告诉PE加载器将物理⽂件偏移PointerToRawData处的数据映射⼊VritualAddress处
VirtualSize: 该段的⼤⼩
SizeOfRawData: 该段的物理⼤⼩。由于存在对齐问题,所以该⼤⼩为不⼩于VirtualSize⼤⼩的对齐⼤⼩的整数倍。
4.通过遍历SECTION TABLE,判断要转换的RVA地址是否处于所有段的RVA地址范围内。该段的RVA范围为: VritualAddress + SizeOfRawData,当然更精确点是VirtualAddress + VirtualSize。
5.假如存在于地址范围内,那么我们可以通过要转换的RVA地址减去该段的VirtualAddress算出相对于该段的偏移量
6.将偏移量加上PointerToRawData,即可算出物理地址。
算法比较复杂。
我们使用OD工具分析。

我们看下地址00400200

果然这地址为code的代码块。
边栏推荐
- Qt读写Excel--QXlsx工作表显示/隐藏状态设置4
- 黑马笔记---List系列集合与泛型
- postman 自動生成 curl 代碼片段
- RK356x U-Boot研究所(命令篇)3.3 env相关命令的用法
- Introduction to the novelty of substrat source code: indexing of call calls and fully completing the materialization of storage layer
- MySQL judges the calculation result and divides it by 100
- Exploring the source code of Boca Cross Chain Communication: Elements
- The independent station is Web3.0. The national "14th five year plan" requires enterprises to build digital websites!
- Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年6月29日21:59:34
- 项目中遇到一个有趣的事情
猜你喜欢

Methodology for troubleshooting problems (applicable to troubleshooting problems arising from any multi-party cooperation)
![[learn awk in one day] operator](/img/52/fd476d95202f3a956fd59437c2d960.png)
[learn awk in one day] operator

FlinkSQL自定义UDATF实现TopN

uniapp支付之APP微信支付unicloud版(附源码)

Resource realization applet opening wechat official small store tutorial

【精选】资源变现资讯、新闻、自媒体、博客小程序(可引流,开通流量主,带pc后台管理)

All the abnormal knowledge you want is here

Android development interview real question advanced version (with answer analysis)

MATLAB小技巧(22)矩阵分析--逐步回归

【C语言深度解剖】float变量在内存中存储原理&&指针变量与“零值”比较
随机推荐
Mqtt ROS simulates publishing a custom message type
Package tronapi wave field interface based on thinkphp5 PHP version -- interface document attached -20220627
golang基础 —— 切片和数组的区别
[surprised] the download speed of Xunlei is not as fast as that of the virtual machine
【C语言深度解剖】float变量在内存中存储原理&&指针变量与“零值”比较
Event handling in QT
LeetCode_栈_中等_227.基本计算器 II(不含括号)
JS 二维数组变一维数组的方法
FlinkSQL自定义UDTF使用的四种方式
Qt中的事件处理
WTM重大更新,多租户和单点登录
App wechat payment unicloud version of uniapp payment (with source code)
JMeter learning notes
Ffmpeg miscellaneous
力扣之螺旋矩阵,一起旋转起来(都能看懂)
Package based on thinkphp5 -tronapi- wave field interface - source code without encryption - can be opened twice - interface document attached - detailed guidance of the author - June 30, 2022 08:45:2
JMeter's performance test process and performance test focus
golang 基础 —— 字符串 与 int 、int64 互转
[one day learning awk] array usage
Golang Basics - string and int, Int64 inter conversion