当前位置:网站首页>逆向调试入门-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的代码块。
边栏推荐
- JS converts an array to a two-dimensional array based on the same value
- 【驚了】迅雷下載速度竟然比不上虛擬機中的下載速度
- 问卷星问卷抓包分析
- Tronapi wave field interface PHP version - interface document attached - package based on thinkphp5 - source code without encryption - can be opened in two - detailed guidance of the author - 11:49:56
- Determining the subject area of data warehouse construction
- 全面解析免费及收费SSH工具的基本特性和总结
- WTM重大更新,多租户和单点登录
- 常用的ui组件
- kaniko官方文档 - Build Images In Kubernetes
- Substrate 源码追新导读: 修复BEEFY的gossip引擎内存泄漏问题, 智能合约删除队列优化
猜你喜欢

Idea 2021.3 golang error: rning: undefined behavior version of delve is too old for go version 1.18
![[surprised] the download speed of Xunlei is not as fast as that of the virtual machine](/img/04/b0d23266b70c9ad6990a5203ef8ddf.png)
[surprised] the download speed of Xunlei is not as fast as that of the virtual machine

postman 自動生成 curl 代碼片段

Qt中的数据库使用

JMeter learning notes

黑马笔记---包装类,正则表达式,Arrays类

【 surprise】 la vitesse de téléchargement de Thunderbolt n'est pas aussi rapide que celle de la machine virtuelle

All the abnormal knowledge you want is here

【招聘(广州)】成功易(广州).Net Core中高级开发工程师

黑马笔记---集合(Collection的常用方法与遍历方式)
随机推荐
Postman automatically generates curl code snippets
【 surprise】 la vitesse de téléchargement de Thunderbolt n'est pas aussi rapide que celle de la machine virtuelle
Three ways for flinksql to customize udaf
Tronapi wave field interface PHP version - interface document attached - package based on thinkphp5 - source code without encryption - can be opened in two - detailed guidance of the author - 11:49:56
ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we cannot accurately
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年6月29日21:59:34
How to solve cross domain problems
FlinkSQL自定义UDTF使用的四种方式
Resource realization applet opening wechat official small store tutorial
Hangzhou E-Commerce Research Institute: the official website (website) is the only form of private domain
2022-06-23 sail soft part formula and SQL generation (month and quarter retrieval)
常用的ui组件
Machine learning notes - Introduction to autocorrelation and partial autocorrelation
第十三章 信号(三)- 示例演示
Js根据相同值将数组转换为二维数组
FlinkSQL自定义UDAF使用的三种方式
Introduction to the novelty of substrat source code: indexing of call calls and fully completing the materialization of storage layer
golang基础 —— 切片几种声明方式
An interesting thing happened in the project
Substrate 源码追新导读: 质押额度大幅度削减, RocksDB可以完全被Disable