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通過。解說不起作用。 | ![]() |