-
-
[求助]Kernel Detective 线程挂起功能
-
发表于:
2011-8-20 11:31
8631
-
[求助]Kernel Detective 线程挂起功能
一个挂起线程的过程应该是
ZwSuspendProcess---->NtSuspendProcess->NtSuspendThread->KeSuspendThread
--->KeInsertQueueApc---->KiInsertQueueApc
所以如果Hook KiInsertQueueApc 应该就可以达到阻止挂起线程
这是我 KiInsertQueueApc 过滤代码
VOID FASTCALL DetourMyKiInsertQueueApc(IN PKAPC Apc,IN KPRIORITY Increment)
{
ULONG thread;
ULONG process;
if(MmIsAddressValid((PULONG)((ULONG)Apc+0x008))) //地址验证 KAPC结构+008--->kthread
{
thread=*((PULONG)((ULONG)Apc+0x008));
//如果目前的APC是我们要保护的Thread
if (thread == (ULONG)pMySystemTHREAD_1)
{
KdPrint(("Some One Want To Kill Me!\n"));
return; //拒绝操作!
}
}
else
return;
if(MmIsAddressValid((PULONG)((ULONG)thread+0x044))) //kthread+30-->KAPC_STATE+10-->eprocess
{
process=*((PULONG)((ULONG)thread+0x044));
}
else
return ;
if(MmIsAddressValid((PULONG)((ULONG)process+0x84))) //eprocess+0x84---->进程ID
{
if ( (*(PULONG)((ULONG)(process)+0x84) == processID) && (Increment==2) )
{
KdPrint(("Some One Want To Kill Me!\n"));
return;//拒绝执行
}
else//放行~呼叫真正函数
{
OriginalKiInsertQueueApc(Apc,Increment);
}
}
else
return;
}
这样的结果,可以防止Kernel Detective v1.3.1结束进程
但却不能防止 "线程挂起" 是因为Kernel Detective有做过特殊处理??
[注意]看雪招聘,专注安全领域的专业人才平台!