-
-
[原创]DKOM Benefits and Drawbacks
-
发表于:
2008-6-1 01:04
11091
-
[原创]DKOM Benefits and Drawbacks
科普了...大侠飘过....
本人还很菜..有写错的地方希望大家多指点
感觉这样隐藏进程比Hook ZwQuerySystemInformation 工序上简单很多,所以BSOD的几率也要小了。不过仍然逃不过IS的法眼...
代码基本是copy Rootkits: Subverting the Windows Kernel 加了点注释。几下笔记。
在win中,每个进程都有一个EPROCESS结构,其中引用了一个双向链表,遍历这个链表,就能列出win当前活动进程。
下面是定义
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
} LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
ULONG FindProcessEPROC (ULONG terminate_PID)
{
//这个函数用来获得指定PID的 EPROCESS偏移
PLIST_ENTRY plist_active_procs;
ULONG eproc;
ULONG PIDOFFSET,current_PID,start_PID, i_count,FLINKOFFSET;
eproc = 0x00000000;
PIDOFFSET = 0x84; //SP2
FLINKOFFSET = 0x88;
current_PID = 0;
start_PID = 0;
i_count = 0;
if (terminate_PID == 0)
return terminate_PID;
// Get the address of the current EPROCESS
eproc = (ULONG) PsGetCurrentProcess();
start_PID = *((ULONG *)(eproc+PIDOFFSET)); //PID
current_PID = start_PID;
while(1)
{
if(terminate_PID == current_PID) // found
return eproc;
else if((i_count >= 1) && (start_PID == current_PID))
{
//当整个循环都遍历完一圈却没有找到这个PID的时候 才会出现这种情况
return 0x00000000;
}
else { // Advance in the list.
plist_active_procs = (LIST_ENTRY *) (eproc+FLINKOFFSET); //LIST
eproc = (ULONG) plist_active_procs->Flink; //the next list entry
eproc = eproc - FLINKOFFSET; //the next EPROCESS
current_PID = *((ULONG *)(eproc+PIDOFFSET)); //THE NEXT PID
i_count++;
}
}
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课