Click here to Skip to main content
15,921,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Terminate a process Pin
Stephen Hewitt10-Mar-10 19:05
Stephen Hewitt10-Mar-10 19:05 
GeneralRe: Terminate a process Pin
R@jeev K R10-Mar-10 19:13
R@jeev K R10-Mar-10 19:13 
GeneralRe: Terminate a process Pin
R@jeev K R10-Mar-10 19:17
R@jeev K R10-Mar-10 19:17 
GeneralRe: Terminate a process Pin
Stephen Hewitt10-Mar-10 19:22
Stephen Hewitt10-Mar-10 19:22 
GeneralRe: Terminate a process Pin
R@jeev K R10-Mar-10 21:09
R@jeev K R10-Mar-10 21:09 
AnswerRe: Terminate a process Pin
KarstenK10-Mar-10 21:26
mveKarstenK10-Mar-10 21:26 
QuestionMaking application as a child one Pin
Pryabu10-Mar-10 18:29
Pryabu10-Mar-10 18:29 
AnswerRe: Making application as a child one Pin
Stephen Hewitt10-Mar-10 18:41
Stephen Hewitt10-Mar-10 18:41 
GeneralRe: Making application as a child one Pin
Pryabu10-Mar-10 18:55
Pryabu10-Mar-10 18:55 
GeneralRe: Making application as a child one Pin
Stephen Hewitt10-Mar-10 18:58
Stephen Hewitt10-Mar-10 18:58 
QuestionCListCtrl custom draw issue Pin
Prasanth Vijayan10-Mar-10 18:11
Prasanth Vijayan10-Mar-10 18:11 
AnswerRe: CListCtrl custom draw issue Pin
Eugen Podsypalnikov10-Mar-10 20:47
Eugen Podsypalnikov10-Mar-10 20:47 
GeneralRe: CListCtrl custom draw issue Pin
Prasanth Vijayan10-Mar-10 20:51
Prasanth Vijayan10-Mar-10 20:51 
QuestionComments in .rgs file Pin
Krishnakumartg10-Mar-10 18:09
Krishnakumartg10-Mar-10 18:09 
AnswerRe: Comments in .rgs file Pin
LunaticFringe10-Mar-10 18:17
LunaticFringe10-Mar-10 18:17 
GeneralRe: Comments in .rgs file Pin
Krishnakumartg10-Mar-10 21:46
Krishnakumartg10-Mar-10 21:46 
QuestionHow can insert menu to dialog by ce application? Pin
Patrick Tang10-Mar-10 15:27
Patrick Tang10-Mar-10 15:27 
AnswerRe: How can insert menu to dialog by ce application? Pin
Patrick Tang10-Mar-10 16:01
Patrick Tang10-Mar-10 16:01 
GeneralRe: How can insert menu to dialog by ce application? Pin
KingsGambit10-Mar-10 17:52
KingsGambit10-Mar-10 17:52 
QuestionDetecting Hooks [modified] Pin
hxhl9510-Mar-10 13:01
hxhl9510-Mar-10 13:01 
AnswerRe: Detecting Hooks Pin
Baltoro10-Mar-10 13:55
Baltoro10-Mar-10 13:55 
GeneralRe: Detecting Hooks Pin
hxhl9510-Mar-10 14:25
hxhl9510-Mar-10 14:25 
GeneralRe: Detecting Hooks Pin
Baltoro11-Mar-10 9:39
Baltoro11-Mar-10 9:39 
GeneralRe: Detecting Hooks Pin
Baltoro11-Mar-10 9:49
Baltoro11-Mar-10 9:49 
GeneralLooking for Hooks Pin
Baltoro11-Mar-10 10:34
Baltoro11-Mar-10 10:34 
I have copied a brief section here about the general techniques involved in looking for User Mode IAT hooks, again, from "Rootkits: Subverting the Windows Kernel". I have left out the description of Inline Hooks, because they are implemented in assembly language and require some experience in disassembling.

Looking For Hooks
A memory-based detection method is to look for hooks within the operating system and within processes. There are many places where a hook can hide, including the following:
Import Address Table (IAT)
System Service Dispatch Table (SSDT), also known as the KeServiceDescriptorTable
Interrupt Descriptor Table (IDT) with one per CPU
Drivers' I/O Request Packet (IRP) handler
Inline function hooks
The basic algorithm for identifying a hook is to look for branches that fall outside of an acceptable range. Such branches would be produced by instructions like call or jmp. Defining an acceptable range is not difficult (for the most part). In a process Import Address Table (IAT), the name of the module containing imported functions is listed. This module has a defined start address in memory, and a size. Those numbers are all you need to define an acceptable range.
Likewise for device drivers: All legitimate I/O Request Packet (IRP) handlers should exist within a given driver's address range, and all entries in the System Service Dispatch Table (SSDT) should be within the address range of the kernel process, ntoskrnl.exe.
Finding Interrupt Discriptor Table (IDT) hooks is a bit more difficult, because you do not know what the acceptable ranges should be for most of the interrupts. The one you know for sure, however, is the INT 2E handler. It should point to the kernel, ntoskrnl.exe.
Inline hooks are the hardest to detect, because they can be located anywhere within the function—requiring a complete disassembly of the function in order to find them—and because functions can call addresses outside the module's address range under normal circumstances. In the following sections, we will explain how to detect SSDT, IAT, and some inline hooks.

Finding IAT Hooks
IAT hooks are extremely popular with current Windows rootkits. IAT hooks are in the userland portion of a process, so they are easier to program than kernel rootkits, and do not require the same level of privilege. Because of this, you should make sure your detection software looks for IAT hooks.
Finding IAT hooks is very tedious, and implementing a search for them requires many of the techniques covered in previous chapters. However, those steps are relatively straightforward. First, change contexts into the process address space of the process you want to scan for hooks. In other words, your detection code must run within the process you are scanning.
Next, your code needs a list of all the DLLs the process has loaded. For the process, and every DLL within the process, your goal is to inspect the functions imported by scanning the IAT and looking for function addresses outside the range of the DLL the function is exported from. After you have the list of DLLs and the address range for each one, you can walk each IAT of each DLL to see whether there are any hooks. Particular attention should be paid to Kernel32.dll and NTDLL.DLL. These are common targets of rootkits, because these DLLs are the userland interface into the operating system.
If the IAT is not hooked, you should still look at the function itself to determine whether an inline hook is present.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.