首页
社区
课程
招聘
[求助]Kernel Detective 线程挂起功能
发表于: 2011-8-20 11:31 8446

[求助]Kernel Detective 线程挂起功能

2011-8-20 11:31
8446
一个挂起线程的过程应该是
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有做过特殊处理??

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 247
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
你应该是在KeInsertQueueApc调用KiInsertQueueApc的地方做的E8方式的hook吧,KeSuspendThread是直接调用KiInsertQueueApc的,不会调用KeInsertQueueApc
2011-8-20 12:30
0
雪    币: 416
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
你這個是只有防止smart terminate,還是也有防護force terminate,kernel detect的砍程序。不管怎麼樣就是把它砍掉的那種。
2011-8-20 12:37
0
雪    币: 1530
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
---------------------------------------------------------------------------------------------
我這是在KiInsertQueueApc下做頭部InlineHook
所以應該是攔截的到才對

下面是Windbg看的
nt!KiInsertQueueApc:
804dac72 e989d52f77      jmp     f77d8200
804dac77 51              push    ecx
804dac78 8bc1            mov     eax,ecx
2011-8-20 13:17
0
雪    币: 1530
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
我其實最終目的只要攔截 線程掛起就好  強力刪除倒是不怕
也是台灣人!?  可以交流一下
2011-8-20 13:18
0
游客
登录 | 注册 方可回帖
返回
//