국내 리버스엔지니어링 관련 문서들을 모은 Archive 입니다.

author : 지현석 
aka : binish 
WebSite : http://binish.or.kr 
Source : http://binish.or.kr/_zb/zboard.php?id=_binishpaper&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=15 

 사실 이 방법은 많은 사람들이 알고 있을 만한 방법입니다만 간략히 다시 정리해 보겠습니다. 진짜 간략하게..

PTHREADINFO pti = NULL;

__asm
{
        mov eax, fs:[0x18] ; get address of TEB
        mov eax, [eax+0x40] ; get address of Win32ThreadInfo
        mov pti, eax ; okay!
}

이렇게 하면 pti 변수를 통해 PTHREADINFO 구조체를 얻게 되죠..?
pti->pDeskInfo->aphkStart[] 배열에 바로 SetWindowsHookEx()를 통해 전역 후킹된 함수가 등록 되니까,
아래와 같은 예제를 통해 확인할 수 있습니다.

aphkStart[ WH_KEYBOARD + 1 ]가 NULL이 아니라면?!
aphkStart[ WH_KEYBOARD + 1 ]를 NULL로 만든다면?!

good luck!

※ 참고
typedef struct tagTHREADINFO
  {
   //W32THREAD;
   //PTL ptl; // Listhead for thread lock list
  // W32THREAD 和 PTL 是我所不知道的结构,通过SoftICE的帮助,我知道了它们的大小,
  //于是我弄了个东东来填充它
   PADDING(padding1 , 0x2c);
   PVOID ppi; // process info struct for this thread
   // type is PPROCESSINFO
   PVOID rpdesk; // type is PDESKTOP
   PDESKTOPINFO pDeskInfo; // Desktop info visible to client
   // type is PDESKTOPINFO
   PCLIENTINFO pClientInfo; // Client info stored in TEB
   // type is PCLIENTINFO
   DWORD TIF_flags; // TIF_ flags go here.
   PUNICODE_STRING pstrAppName; // Application module name.
   PVOID psmsSent; // Most recent SMS this thread has sent
   // type is PSMS
   PVOID psmsCurrent; // Received SMS this thread is currently processing
   // type is PSMS
   PVOID psmsReceiveList; // SMSs to be processed
   // type is PSMS
   LONG timeLast; // Time, position, and ID of last message
   ULONG_PTR idLast;
   int cQuit;
   int exitCode;
   HDESK hdesk; // Desktop handle
   // HDESK
   int cPaintsReady;
   UINT cTimersReady;
   PVOID pMenuState; // type is PMENUSTATE
   union {
   PVOID ptdb; // Win16Task Schedule data for WOW thread
   // type is PTDB
   PVOID pwinsta; // Window station for SYSTEM thread
  // type is PWINDOWSTATION
   };
   PVOID psiiList; // thread DDEML instance list
   // type is PSVR_INSTANCE_INFO
   DWORD dwExpWinVer;
   DWORD dwCompatFlags; // The Win 3.1 Compat flags
   DWORD dwCompatFlags2; // new DWORD to extend compat flags for NT5+ features
   PVOID pqAttach; // calculation variabled used in
   // type is PQ
   // zzzAttachThreadInput()
  
   PTHREADINFO ptiSibling; // pointer to sibling thread info
  
   PVOID pmsd; // type is PMOVESIZEDATA
  
   DWORD fsHooks; // WHF_ Flags for which hooks are installed
  
   PHOOK sphkCurrent; // Hook this thread is currently processing
   // type is PHOOK
  
   PVOID pSBTrack; // type is PSBTRACK
  
   HANDLE hEventQueueClient;
   PVOID pEventQueueServer; // type is PKEVENT
   PVOID PtiLink; // Link to other threads on desktop
   // type is LIST_ENTRY
   int iCursorLevel; // keep track of each thread's level
  
   PADDING(padding2 , 4);
   POINT ptLast;
  
   PWND spwndDefaultIme; // Default IME Window for this thread
   // type is PWND
   PVOID spDefaultImc; // Default input context for this thread
   // type is PIMC
   HANDLE hklPrev; // Previous active keyboard layout
  // type is HKL
   int cEnterCount;
  
   MLIST mlPost; // posted message list.
   USHORT fsChangeBitsRemoved;// Bits removed during PeekMessage
   WCHAR wchInjected; // character from last VK_PACKET
   DWORD fsReserveKeys; // Keys that must be sent to the active
   // active console window.
   PVOID *apEvent; // Wait array for xxxPollAndWaitForSingleObject
   // type is PKEVENT
   ACCESS_MASK amdesk; // Granted desktop access
   UINT cWindows; // Number of windows owned by this thread
   UINT cVisWindows; // Number of visible windows on this thread
  
   PHOOK aphkStart[CWINHOOKS]; // Hooks registered for this thread
   // type is PHOOK
   BYTE cti; // Use this when no desktop is available
   // type is CLIENTTHREADINFO
  
   }THREADINFO ,* PTHREADINFO;

  1. [2009/09/29] DLL Injection은 어떻게 이루어지는가
  2. [2009/09/14] 네이트온(NateOn) 3.7.10.3(966) 로그인 과정 분석
  3. [2009/09/14] Keylogging Analysis (using polling interrupt)
  4. [2009/09/14] Keyboard Security
  5. [2009/09/14] Advanced BufferOverflow Attack Skill
List of Articles
번호 author aka 제목
37 김범연  ccibomb  Hooking SSDT 후킹 탐지기법 imagefile
36 이동수  alonglog  Hooking SSDT Hooking을 이용한 프로세스와 파일 숨기기 imagefile
35 장상근  Maxoverpro  Network SSH Brute-Force Login Attack 분석과 대응 imagefile
34 정지훈  binoopang  Binary Analysis Manual Binary Mangling with Radare imagefile
33 심준보  passket  PPT A Practice of Remote Code excution using cpu bug imagefile
32 정의진  eureka386  PPT Break the secure USB imagefile
31 김경수  kaspyxx  PPT The Way of Inject code to Process imagefile
30 crattack  crattack  Hooking detours와 iat hooking 사용하기 imagefile
29 이구호  lucid7  Operating System SEH Overflow imagefile
28 이용일  foryou2008  Binary Analysis Design and Implementation of Virtualized Code Protection For Anti-Reverse Engineering imagefile
27 박천성  ashine  UnPacking The Art of Unpacking (원저자: Mark Vincent Yason) imagefile
26 정혜성  정혜성  Manual ProcessExplorer Manual imagefile
25 정혜성  정혜성  Manual IceSword Manual imagefile
24 정혜성  정혜성  Manual TCPView Manual imagefile
23 정혜성  정혜성  Manual Autoruns Manual imagefile
22 김범연  ccibomb  Operating System DKOM 탐지기법 imagefile
21 안기찬  Externalist  Basic Reversing MFC Applications file
20 이강석  Certlab  Basic 인텔 메뉴얼을 이용하여 OPCODE를 어셈블리어 명령으로 변환하기 file
19 박찬암  hkpco  Binary Analysis DEFCON 2009 Capture The Flag 본선 문제 풀이 - tucod
18 박찬암  hkpco  Malware Analysis 777 DDoS 악성코드 분석 file
17 박찬암  hkpco  Basic Mem Jacking
16 안기찬  Externalist  Binary Analysis Reversing Binary500 (Defcon 2007) file
15 지현석  binish  Buffer Overflow Advanced BufferOverflow Attack Skill
14 지현석  binish  Network 네이트온(NateOn) 3.7.10.3(966) 로그인 과정 분석
» 지현석  binish  Hooking SetWindowsHookEx 후킹 제거
12 박찬암  hkpco  Basic Linux Kernel Memory Disclosure 취약성의 기초
11 박찬암  hkpco  Binary Analysis ActiveX 취약성 공격시의 Unicode Shellcode file
10 김연재  bl4ck3y3  Binary Analysis DEFCON 2009 Binary L33tness 100, EDB로 풀어보자 imagefile
9 박찬암  hkpco  Binary Analysis DEFCON 2008 Capture The Flag 본선 문제 풀이 - bakalakadakaChat_d
8 박찬암  hkpco  Basic Core Rootkit Technology for Linux Kernel 2.6

XE Login

OpenID Login