covirt
1.0.0

VM 기반 난독 화를위한 x86-64 코드 가상화기.
*PE 지원 MINGW-W64를 통해 편집 된 바이너리에서만 테스트되었습니다
CMake 이러한 모든 종속성을 가져 오므로 직접 설치할 필요는 없습니다.
| 이름 | 버전 |
|---|---|
| cmake | 3.25+ |
| Zydis | 4.1.0+ |
| zasm | 최신 |
| Lief | 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_...(); Stubs는 인라인 어셈블리를 사용하기 때문에 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 AS ELF : 15.5 KB-> 1.0 MBa.out AS A PE : 259.3 KB-> 1.3 MB | 설명 | 아이다 |
|---|---|
MBA 패스만으로 난독 화 된 vm_entry 의 IDA 분해. 디 컴파일러에 의해 27K LOC 이상이 생성되었습니다. | ![]() |
MBA & SMC 패스를 통해 난독 화 된 vm_entry 의 IDA 분해. 코 컴파일은 작동하지 않습니다. | ![]() |