首页 > 其他分享 >[ida pro] 设置RVA 偏移

[ida pro] 设置RVA 偏移

时间:2024-05-13 17:30:11浏览次数:10  
标签:RVA ULONG 32 pro 偏移量 偏移 ida IDA

在使用IDA PRO分析X64 异常展开,进行_SCOPE_TABLE类型设置时,将操作数转换为偏移量

目录

示例:UNWIND_INFO 分析

image

image

  • _C_specific_handler_0 是一个导入函数,是进行异常处理分发的,可以不用分析。
  • 下面跟着的为_SCOPE_TABLEl数据
typedef struct _SCOPE_TABLE {
        ULONG Count;
        struct
        {
            ULONG BeginAddress;
            ULONG EndAddress;
            ULONG HandlerAddress;
            ULONG JumpTarget;
        } ScopeRecord[1];
    } SCOPE_TABLE, *PSCOPE_TABLE;

1、添加ScopeRecord类型

image

2、设置类型

image

3、将操作数转换为偏移量

双击类型来到struct窗口,设置偏移,(快捷键CTRL+R
image
调整偏移设置
image

4、设置完成

image

链接1

如何分析X64的SEH

链接2

igors-tip-of-the-week-113-image-relative-offsets-rva

Image-relative offsets are values that represent an offset from the image base of the current module (image) in memory. This means that they can be used to refer to other locations in the same module regardless of its real, final load address, and thus can be used to make the code position-independent (PIC), similarly to the self-relative offsets. The alternative name RVA means “Relative virtual address” and is often used in the context of the PE file format.
图像相对偏移量是表示与内存中当前模块(图像)的图像基础的偏移量的值。这意味着它们可用于引用同一模块中的其他位置,而不管其实际的最终加载地址如何,因此可用于使代码位置无关 (PIC),类似于自相对偏移。替代名称 RVA 的意思是“相对虚拟地址”,通常用于 PE 文件格式的上下文中。

However, PIC is not the only advantage of RVAs. For example, on x64-bit platforms RVA values usually use 32 bits instead of 64 like a full pointer. While this makes their range more limited (4GiB from imagebase), the savings from pointer-type values can be substantial when accumulated over the whole binary.
然而,PIC 并不是 RVA 的唯一优势。例如,在 x64 位平台上,RVA 值通常使用 32 位,而不是像完整指针那样使用 64 位。虽然这使得它们的范围更加有限(来自 imagebase 的 4GiB),但当在整个二进制文件中累积时,指针类型值的节省可能会很大。

For known RVA values, such as those in the PE headers or EH structures, IDA can usually convert them to an assembler-specific expression automatically:
对于已知的 RVA 值,例如 PE 标头或 EH 结构中的值,IDA 通常可以自动将它们转换为特定于汇编程序的表达式:

image

However, sometimes there may be a need to do it manually, for example, when dealing with another update of the file format not yet handled by IDA, or a custom format/structure which uses RVAs for addressing. In that case, you can use yet another variation of the User-defined offset. The option to turn on is Use image base as offset base. When it’s enabled, IDA will ignore the entered offset base and will always use the imagebase.
但是,有时可能需要手动执行此操作,例如,在处理 IDA 尚未处理的文件格式的另一个更新时,或使用 RVA 进行寻址的自定义格式/结构时。在这种情况下,您可以使用用户定义的偏移量的另一种变体。打开的选项是使用图像基底作为偏移基。启用后,IDA 将忽略输入的偏移基数,并始终使用图像基数。

image

However, even if you use this approach in a 64-bit program, you may fail to reach the desired effect: the value will be displayed in red to indicate an error and not show a nice expression with the final address, as expected.
但是,即使在 64 位程序中使用此方法,也可能无法达到预期的效果:该值将以红色显示以指示错误,并且不会像预期的那样显示带有最终地址的漂亮表达式。

image

This happens because the command defaults to OFF32 for 32-bit values, but the final address does not fit into 32 bits. The fix is simple: select OFF64 instead of OFF32.
发生这种情况的原因是,对于 32 位值,该命令默认为 OFF32,但最终地址不适合 32 位。解决方法很简单:选择 OFF64 而不是 OFF32。

image

image

NOTE: for ARM binaries, the imagerel keyword is used instead of rva.
注意:对于 ARM 二进制文件,使用 imagerel 关键字而不是 rva .

See also: 另请参阅:

Igor’s tip of the week #105: Offsets with custom base
伊戈尔的本周小贴士 #105:使用自定义底座进行偏移

Igor’s tip of the week #110: Self-relative offsets
伊戈尔的本周小贴士 #110:自相对偏移

标签:RVA,ULONG,32,pro,偏移量,偏移,ida,IDA
From: https://www.cnblogs.com/DirWang/p/18189530

相关文章

  • Find Products of Elements of Big Array
    FindProductsofElementsofBigArrayA powerfularray foraninteger x istheshortestsortedarrayofpowersoftwothatsumupto x.Forexample,thepowerfularrayfor11is [1,2,8].Thearray big_nums iscreatedbyconcatenatingthe powerful......
  • C#中 ProcessStartInfo、process启动一个外部程序
    在C#中,ProcessStartInfo类是System.Diagnostics命名空间中的一部分,它用于控制Process类启动新进程时的各种设置。所以在定义了一个ProcessStartInfo之后还得定义一个Process并将前者的设置绑定给后者。示例:ProcessStartInfopsi=newProcessStartInfo......
  • setTimeout模拟interval
    functionrunTimer(list=[ { delay:2000, text:'第一步延迟2s' }, { delay:3000, text:'第二步延迟3s' }, { delay:1000, text:'第三步延迟1s' }, ],cb=(text)=>{ console.log('渲染回调&......
  • 宝塔:续签SSL证书报错error_result: During secondary validation
    宝塔上的SSL证书有时候忘了到期前续签,导致续签时候报错:error_result:Duringsecondaryvalidation:或者 该帐户1小时内失败的订单次数超过5次,请等待1小时再重试! 点击SSL当前证书,续签证书处理,是无效的。因此要换种方式: 解决方法如下:1.点击SSL选项框内的“证书夹”选项,删......
  • GRPC - Deploying: Envoy proxy
    Installfunc-e: https://func-e.io/func-emakesrunningEnvoy®easyfunc-e(pronouncedfunky)allowsyoutoquicklyseeavailableversionsofEnvoyandtrythemout.Thismakesiteasytovalidateconfigurationyouwoulduseinproduction.Eachtimeyoue......
  • Dockerfile - build zgrpc-go-professionals:client
     FROM--platform=$BUILDPLATFORMalpineasprotocARGBUILDPLATFORM=linux/amd64TARGETOS=linuxTARGETARCH=amd64#downloadtheprotocbinaryfromgithub#Weunzipthefileinto/usr/local.Noticethatweareextractingboththeprotoc#binary(/bin/pr......
  • Prometheus TSDB概念介绍
    PrometheusTSDB概念介绍序言为了让新入门的学习者更好地学习后续的文章,本文会针对prometheus中的一些概念进行简要介绍基本概念metricname:指标名称,对于监控数据而言,每一个监控数据都需要有一个指标名称,如监控一个服务接收到的http请求数,那么metricname一般设置为http_requ......
  • 部署Prometheus Operator完整流程及踩坑解决思路
    环境信息软件版本号LinuxCentos7.9k8sv1.26.9Docker25.0.4kube-prometheusv0.13.0nginx-ingress-controllerv1.10.1K8S集群信息(提前安装好自己的集群,本文不再讲解集群的安装)主机名IPk8s-master192.168.2.11k8s-node01192.168.2.1......
  • Dockerfile - build zgrpc-go-professionals:server
     FROM--platform=$BUILDPLATFORMalpineasprotocARGBUILDPLATFORM=linux/amd64TARGETOS=linuxTARGETARCH=amd64#downloadtheprotocbinaryfromgithub#Weunzipthefileinto/usr/local.Noticethatweareextractingboththeprotoc#binary(/bin/pr......
  • 抽丝剥茧:详述一次DevServer Proxy配置无效问题的细致排查过程
    事情的起因是这样的,在一个已上线的项目中,其中一个包含登录和获取菜单的接口因响应时间较长,后端让我尝试未经服务转发的另一域名下的新接口,旧接口允许跨域请求,但新接口不允许本地访问(只允许发布测试/生产的域名访问)。问题那么问题来了,本地环境该如何成功访问到新的接口并验证业务......