covirt
1.0.0

用于基于VM的混淆的X86-64代码虚拟化器。
*仅在通过mingw-w64编译的二进制文件上测试的PE支持
CMake将获取所有这些依赖性,因此不需要自己安装它们。
| 姓名 | 版本 |
|---|---|
| cmake | 3.25+ |
| Zydis | 4.1.0+ |
| zasm | 最新的 |
| 利夫 | 0.15.1+ |
为了构建,需要C++23兼容编译器。
git clone https://github.com/dmaivel/covirt.git
cd covirt
mkdir build
cd build
cmake ..
cmake --build . --config Release如果您通过Visual Studio在Windows上编译,则必须使用clang-cl : cmake .. -T ClangCL -A x64 。
Usage: covirt [--help] [--version] [--output OUTPUT_PATH] [--vm_code_size MAX] [--vm_stack_size SIZE] [--no_self_modifying_code] [--no_mixed_boolean_arith] [--show_dump_table] INPUT_PATH
Code virtualizer for x86-64 ELF & PE binaries
Positional arguments:
INPUT_PATH path to input binary to virtualize
Optional arguments:
-h, --help shows help message and exits
-v, --version prints version information and exits
-o, --output OUTPUT_PATH specify the output file [default: INPUT_PATH.covirt]
-vcode, --vm_code_size MAX specify the maximum allowed total lifted bytes [default: 2048]
-vstack, --vm_stack_size SIZE specify the size of the virtual stack [default: 2048]
-no_smc, --no_self_modifying_code disable smc pass
-no_mba, --no_mixed_boolean_arith disable mba pass
-d, --show_dump_table show disassembly of the vm instructions要covirt需要虚拟化哪些函数,则必须将开始和结束标记添加到源代码中,例如:
#include "covirt_stub.h"
int my_function (...)
{
int result = 0 ;
__covirt_vm_start ();
// ...
__covirt_vm_end ();
return result ;
}重要的
__covirt_vm_end放置在无法到达的位置(即返回后),因为这将防止结束存根发射__covirt_vm_...();存根不使用MSVC ,因为它们使用内联装配SSE4支持
#include <covirt_stub.h>
#include <stdio.h>
int calculate ( int a , int b )
{
int result = 0 ;
__covirt_vm_start ();
for ( int i = 0 ; i < 10 ; i ++ )
if ( i > 5 )
result += result + a ;
else
result += ( result >> 1 ) + b ;
printf ( "result = %dn" , result );
__covirt_vm_end ();
return result ;
}
int main ()
{
calculate ( 5 , 12 );
}上面的示例应用程序使用covirt a.out -d虚拟化,该应用程序在混淆和虚拟化后输出VM指令的转储。当前的VM实现将大多数操作数推向堆栈以处理它们,从而降低了编码VM指令的复杂性。对于没有定义的VM处理程序的说明,它们将被本地执行( vm_exit > native instruction - > vm_enter )。调用函数遵循同一管道,我们退出,调用该功能,然后将VM重新输入。总的来说,转换使二进制体的大小显着增长:
a.out作为ELF :15.5 kb-> 1.0 MBa.out作为PE :259.3 KB-> 1.3 MB | 描述 | 艾达 |
|---|---|
vm_entry的IDA解码,仅通过MBA通行证被混淆。超过27K的LOC由分解器产生。 | ![]() |
vm_entry的IDA拆卸,已通过MBA&SMC通过。解说不起作用。 | ![]() |