当前位置:网站首页>【逆向】脱壳后修复IAT并关闭ASLR
【逆向】脱壳后修复IAT并关闭ASLR
2022-07-06 09:33:00 【TiggerRun】
0x1 寻找OEP
OEP八大法…这里不具体展开…

0x2 加壳程序的IAT
脱壳后如遇到程序无法正常运行(XP环境),可能是因为导入表破坏,需要手动修复。
通过PC文件格式的学习,可以知道导入表的RVA在可选头的DataDirectory数组中存放

图为加壳程序DESCRIPTOR的偏移 18008,大小64
根据节区头的信息定位IAT在第6个节区 .aspack 中
通过节区已知的虚拟偏移与物理偏移可以计算出DESCRIPTOR在文件中的位置。
offset = A008

找到导出表的位置,可以知道导入了两个DLL文件,可以分别计算出Name和IAT的偏移
NAME(1) = 9FC8
NAME(2) = A044
IAT(1) = 9FB8
IAT(2) = A04F


当然如果对PC头不了解,可以借助PE View进行查看。

这样就清晰的看到加壳后的程序在启动时导入的函数
0x3 运行时压缩的原理

可能存在疑问,为什么脱壳后需要手动修复IAT。
IAT主要用于DLL文件的重定位,IAT的引入相较于 16位dos程序 不再需要包含库文件,而是通过表的形式进行映射。如果IAT不准确,则程序无法执行相关库的函数。
压缩壳对节区进行了压缩,把IAT修改为壳自身的IAT,在解压缩的最后一步会还原IAT使程序可以正常运行,所以脱壳后需要进行IAT的修复。
通过OD查看运行后程序的IAT。
相较于加壳程序的IAT,运行加壳程序后真正的IAT要多的多,如果我们只进行脱壳,而不进行IAT的修复(如下图所示)
程序的IAT是被损坏的
0x4 IAT修复
使用ImportREC工具,加载处于OEP的程序进程
填写正确的IAT信息
获取到内存中的IAT信息,然后删除无效函数后转存到脱壳后程序中,程序即可正常运行。

0x5 脱壳程序无法在WIN7以上平台运行
windows vista / win7 系统就开始使用ASLR技术防止溢出攻击。使得每次加载程序都加载到一个随机虚拟地址。ASLR依赖于重定位表进行定位,对于EXE程序来说,重定位是可选的,通过关闭ASLR即可解决。
将 40 81 改为 00 81
边栏推荐
- Only learning C can live up to expectations top3 demo exercise
- Use of mongodb in node
- Logical operation instruction
- Log4j2 major vulnerabilities and Solutions
- JVM garbage collector part 2
- Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021
- Conception du système de thermomètre numérique DS18B20
- Some instructions on whether to call destructor when QT window closes and application stops
- ByteDance technical Interviewer: what kind of candidate do I want to pick most
- Install docker under windows10 (through Oracle VM VirtualBox)
猜你喜欢

Flink 解析(三):内存管理

服务器端渲染(SSR)和客户端渲染(CSR)的区别

JVM garbage collector part 1

Introduction to spring trick of ByteDance: senior students, senior students, senior students, and the author "brocade bag"

8086 CPU internal structure

Assembly language segment definition

Some instructions on whether to call destructor when QT window closes and application stops

复盘网鼎杯Re-Signal Writeup

The daemon thread starts redis and modifies the configuration file

"One year after graduation, I won ACL best paper"
随机推荐
Prototype chain inheritance
复盘网鼎杯Re-Signal Writeup
登陆验证koa-passport中间件的简单使用
Log4j2 major vulnerabilities and Solutions
mysql的列的数据类型详解
Programmer orientation problem solving methodology
Flink 解析(六):Savepoints
搭建flutter环境入坑集合
关于Stream和Map的巧用
Alibaba cloud server builds SVN version Library
逻辑运算指令
汇编语言基础知识
MySQL digital function
JVM之垃圾回收器上篇
JVM garbage collector part 1
Flink 解析(七):时间窗口
vscode
肖申克的救赎有感
List集合数据移除(List.subList.clear)
Go language uses the thrift protocol to realize the client and service end reports not enough arguments in call to oprot Writemessagebegin error resolution