当前位置:网站首页>逆向调试入门-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的代码块。
边栏推荐
- zabbix-server启动失败处理方式
- 波卡跨链通信源码探秘: 要素篇
- Dark horse notes -- wrapper class, regular expression, arrays class
- 【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(二)
- Event handling in QT
- RK356x U-Boot研究所(命令篇)3.3 env相关命令的用法
- FlinkSQL自定义UDATF实现TopN
- Introduction to the renewal of substrate source code: the pledge amount is greatly reduced, and rocksdb can be completely disabled
- The independent station is Web3.0. The national "14th five year plan" requires enterprises to build digital websites!
- Unity脚本的基础语法(3)-访问游戏对象组件
猜你喜欢
Postman automatically generates curl code snippets
Flinksql customizes udatf to implement topn
Four ways for flinksql to customize udtf
FlinkSQL自定义UDATF实现TopN
rpm2rpm 打包步骤
电机控制Clarke(α/β)等幅值变换推导
Derivation of Park transformation formula for motor control
排查问题的方法论(适用于任何多方合作中产生的问题排查)
All the abnormal knowledge you want is here
Machine learning notes - Introduction to autocorrelation and partial autocorrelation
随机推荐
IDEA 2021.3 执行 golang 报错:RNING: undefined behavior version of Delve is too old for Go version 1.18
Visual studio configures QT and implements project packaging through NSIS
JS converts an array to a two-dimensional array based on the same value
MATLAB小技巧(22)矩阵分析--逐步回归
商品服务-平台属性
Resource realization applet opening traffic main tutorial
Unity脚本的基础语法(5)-向量
When MySQL judges that the execution condition is null, it returns 0. Correct parameter count in the call to native function 'isnull',
产品经理专业知识50篇(七)-如何建立一套完整的用户成长体系?
基于ThinkPHP5封装tronapi-波场接口-PHP版本--附接口文档-20220627
rpm2rpm 打包步骤
Matlab tips (22) matrix analysis -- stepwise regression
Exploring the source code of Boca Cross Chain Communication: Elements
Product manager professional knowledge 50 (7) - how to establish a complete set of user growth system?
Android development interview real question advanced version (with answer analysis)
kaniko官方文档 - Build Images In Kubernetes
Definition of variables and assignment of variables in MySQL
黑马笔记---List系列集合与泛型
Charles break point modify request data & response data
Docker installation of mysql8 and sqlyong connection error 2058 solution [jottings]