2014. 10. 14. 17:26
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

분류


API Based Detection -> 

     -> FindWindow() 활용 ->윈도우 창을 찾는 함수 -> ollydbg, winDBG.... 여러가지 디버거들 찾기

     -> Registry Key Detection() -> 레지스트리 키값 찾기 

     -> IsDebuggerPresent() -> 디버깅 탐지 자체 함수 

     -> CheckRemote....

...

     -> RDTSC -> 시간을 얻어오는 명령어 


Process and Thread Block Detection  -> 

-> IsDebuggerPresent() Direct Access

-> ...



Hardware and Register based Detection -> 하드웨어 브레이크 포인트 기록이 있는지 없는지로 

        디버깅중인지 판단 

        MUP 부분 참조 -> DR레지스터는 디버그 레지스터 


Vmware sldt detection -> 악성코드는 호스트에서 분석을 안                         하니 가상 OS이면 그냥 디버깅 중이라 판단 


CC  -> 소프트 웨어 브레이크 포인트

-> 쓰레기값을 표현 



Exception Based Detection  -> 예외처리 

-> 에러가 뜬다 -> 누군가가 처리해주고 있다 

   -> 권한이 실행파일에서 OS로 가지 않고 디버거로 가는 경우 

-> 일부러 예외를 발생시킨 후 -> 별도의 코드 ..etc 실행 

-> debugee 디버깅 대상 



Timing Based Detection -> 정상적인 실행 시간보다 오래걸리면 디버깅으로 판단 



--------------------


안티 디버깅 -> IsDebuggerPresent()




#define _WIN32_WINNT 0x501

#include <stdio.h>

#include <windows.h>


//BOOL WINAPI IsDebuggerPresent(void);

  // WINAPI ->함수호출 규약, stdcall과 같음

  //BOOL -> 참/거짓

int main(){


printf("==== IsDebuggerPresent Exam ====\n\n");


if(IsDebuggerPresent()){

printf("Debugging detected !!\n");

system("pause");

exit(0);

}else{

printf("Normal execution \n");

}

return 0;

}




---------------------


ctrl + g, a, e




Visual Basic에서 Build optimization을 disable로 하여 디버깅 모드가 제외된 

상태의 파일이 Release폴더에 생성됨 




IsDebuggerPresent함수 따라가보기 

-> TEB라는 구조체에 접근하기 위한 과정 


MOV EAX, DWORD PTR FS:[18]   -> TEB라는 구조체의 주소 t for thread

MOV EAX, DWORD PTR DS:[EAX+30]   -> PEB라는 구조체의 주소, p for process

MOVZX EAX, BYTE PTR DS:[EAX+2]    -> BeingDebugged라는 멤버가 디버깅중일때는 1로 

 아닐때는 0으로 세팅됨 



--------------------



FindWindow()

실행되고 있는 창을 찾아주는 함수 


HWND FindWindow( LPCTSTR IpClassName,

     LPCTSTR IpWindowName);




#include <stdio.h>

#include <windows.h>


int main(){

printf("===FindWindow Exam ===\n\n");


if(FindWindow("notepad",0)){

MessageBox(0, "Debugger Detected !!", "Warning",MB_OK);

}else{

printf("Normal Execution\n");

}

return 0;

}




spy ++

-> cation name이 아니라 class name으로 찾는 이유 확인 



--------


안티디버깅 우회



Up&amp;Down(fw).exe











'Reversing' 카테고리의 다른 글

dll injection  (0) 2014.10.16
The usages of loadLibrary() for making dll and function pointer  (0) 2014.10.15
crackme and winapi  (0) 2014.10.13
crackme and win32API  (0) 2014.10.08
packing  (0) 2014.10.07
Posted by af334