吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4747|回复: 14
收起左侧

[Unpackers] VMPImportFixer

[复制链接]
风吹屁屁凉 发表于 2021-8-19 12:09

VMPImportFixer

VMPImportFixer is a tool aimed to resolve import calls in a VMProtect'd (3.x) binary.

Information

VMPImportFixer attempts to resolve all obfuscated API calls in a VMProtect'd binary. A binary which has VMProtect's "Import Protection" option enabled will have all it's CALL NEAR instructions replaced with near relative call instructions (see ImportCallObfuscator for a similar method of obfuscating imports).

VMProtect usually has two different variations of import calls which seem to be chosen at random once the binary is protected. The first, being push reg; call func, and the other being call func; ret/int3.

image.png
image.png

Following these calls lead into the VMProtect section, which, by default is named .vmp0. Each stub can vary in complexity and size, however the concept is generally the same. Through a series of arithmetic which is used to calculate the real import address, the final operation usually sets [rsp]/[esp] to the import address before the final RET instruction.

Based on the variant of the call (push reg; call func or call func; int3/ret), the stub may increment the return address. This use of the extra byte and return address incrementing is used to break various decompilers from properly analyzing a function due to the decompiler not recognizing that the byte will be skipped over in runtime.

With this information combined, I decided to write a tool over the day that solves these calls. I was not happy with public implementations due to various reasons. One was closed-source, and seemed to be limited to a debugger, and the other lifts these stubs into a IL which seems impractical. I decided to go the emulation route as this trivially tackles the problem and supports both X86 and X86-64 flawlessly.

VMPImportFixer is an all-in-one tool; it will support X86 processes regardless of being in a X64 context. This means that there is no need for architecture dependent versions of the binary.

Usage

Usage:  VMPImportFixer
  -p            (required) process name/process id
  -mod:         (optional) name of module to dump.
  -section:     (optional) VMP section name to use if changed from default (VMP allows custom names)

Examples

<details>
<summary>Images</summary>

  • Before
    b1

  • After
    a1

  • Before
    b2

  • After
    a2
    </details>

TODO

  • Add support for loading binaries off the disk into a state where it can be monitored at specific stages (such as unpacking) then fixed.
  • Add relocation handling on X86 binaries.
  • Kernel support.

Dependencies

Credits

mrexodia for his contribution to HookHunter regarding ReadMemory inside the Process class.



Download:https://github.com/mike1k/VMPImportFixer

免费评分

参与人数 2吾爱币 +2 热心值 +2 收起 理由
guols-cracker + 1 + 1 鼓励转贴优秀软件安全工具和文档!
笙若 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

wlm2421331 发表于 2021-8-19 12:17
膜拜大神
skip2 发表于 2021-8-19 14:11
nug 发表于 2021-8-19 14:41
170077000 发表于 2021-8-19 19:03
不会用啊  老大
xiawan 发表于 2021-8-20 08:46

感谢楼主分享~~~
vbuser 发表于 2021-8-20 14:54
好东西,可惜不会编译
aonima 发表于 2021-8-20 18:38
可惜,看不懂english
jodieo 发表于 2021-8-21 00:35
学习以下了~
嘛名字不名字的 发表于 2021-12-26 17:39
完全看不懂是什么
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-12-23 05:20

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表