'가상머신탐지'에 해당되는 글 1건
2007/12/21 10:19
[리버싱]
Pascal 코드
2008.11.21 vbdream님이 c언어로 작성해주신 코드를 다음과 같이 추가합니다..
출처:
http://rootkits.ru/library/ShowLib.aspx?id_l=25
http://www.excode.ru/art4050.html
http://chitchat.at.infoseek.co.jp/vmware/backdoor.html
program wvvare;
{$APPTYPE CONSOLE}
uses
SysUtils;
function IsVMwarePresent(): LongBool; stdcall;
begin
Result := False;
{$IFDEF CPU386}
try
asm
mov eax, 564D5868h
mov ebx, 00000000h
mov ebx, 00000000h
mov ecx, 0000000Ah
mov edx, 00005658h
in eax, dx
cmp ebx, 564D5868h
jne @@exit
mov Result, True
@@exit:
end;
except
Result := False;
end;
{$ENDIF}
end;
function running_inside_vpc: boolean; assembler;
asm
push ebp
mov ecx, offset @@exception_handler
mov ebp, esp
push ebx
push ecx
push dword ptr fs:[0]
mov dword ptr fs:[0], esp
mov ebx, 0
mov eax, 1
db 00Fh, 03Fh, 007h, 00Bh
mov eax, dword ptr ss:[esp]
mov dword ptr fs:[0], eax
add esp, 8
test ebx, ebx
setz al
lea esp, dword ptr ss:[ebp-4]
mov ebx, dword ptr ss:[esp]
mov ebp, dword ptr ss:[esp+4]
add esp, 8
jmp @@ret
@@exception_handler:
mov ecx, [esp+0Ch]
mov dword ptr [ecx+0A4h], -1
add dword ptr [ecx+0B8h], 4
xor eax, eax
ret
@@ret:
end;
begin
if IsVMwarePresent()
then
writeln( 'Found VMware!');
begin
if running_inside_vpc
then
writeln( 'Found VirtualPC!');
end;
end.
2008.11.21 vbdream님이 c언어로 작성해주신 코드를 다음과 같이 추가합니다..
#include#include int __stdcall IsVMWarePresent() { int Result = 0; __try { __asm { pushad mov eax, 564D5868h mov ebx, 00000000h mov ebx, 00000000h mov ecx, 0000000Ah mov edx, 00005658h in eax, dx mov Result, ebx } if(Result == 0x564D5868) { return 1; } else { return 0; } } __except(EXCEPTION_EXECUTE_HANDLER) { } return Result; } __declspec(naked) int __stdcall running_inside_vpc(void) { __asm { push ebp mov ecx, offset exception_handler mov ebp, esp push ebx push ecx push dword ptr fs:[0] mov dword ptr fs:[0], esp mov ebx, 0 mov eax, 1 __emit 00Fh __emit 03Fh __emit 007h __emit 00Bh //lbl_continue: mov eax, dword ptr ss:[esp] mov dword ptr fs:[0], eax add esp, 8 test ebx, ebx setz al lea esp, dword ptr ss:[ebp-4] mov ebx, dword ptr ss:[esp] mov ebp, dword ptr ss:[esp+4] add esp, 8 jmp lbl_ret exception_handler: mov ecx, [esp+0Ch] mov dword ptr [ecx+0A4h], -1 add dword ptr [ecx+0B8h], 4 xor eax, eax lbl_ret: ret } } // 엔트리 포인트 int main(int argc, char **argv) { if(IsVMWarePresent() || running_inside_vpc()) { printf("VM Running! "; } else { printf("VM doesn't Running! "; } return 0; }
출처:
http://rootkits.ru/library/ShowLib.aspx?id_l=25
http://www.excode.ru/art4050.html
http://chitchat.at.infoseek.co.jp/vmware/backdoor.html

