最近发现一个内核anti调试器的东东 现象是在R3调用DebugActiveProcess无法正常返回,长时间卡死 如果以CreateProcess加载则会在WaitForDebugEvent卡住 因为anti双机内核调试,只能自己写代码拦截流程 发现以CreateProcess方式启动后在内核已经执行到 DbgkpSendApiMessage,再往下已通知调试子系统 调试子系统一节好像也只介绍到这一步 想问下什么情况下会导致上面的情况没有响应呢?
另外写代码的时候发现个有趣的东东 书201页DbgkpSendApiMessage的函数声明参数是3个 在我的XP sp2的系统里却只有2个 很是花了大半天的时间....
lkd> u DbgkpSendApiMessage nt!DbgkpSendApiMessage: 8063919a 8bff mov edi,edi 8063919c 55 push ebp 8063919d 8bec mov ebp,esp 8063919f 53 push ebx 806391a0 33db xor ebx,ebx 806391a2 385d0c cmp byte ptr [ebp+0Ch],bl 806391a5 56 push esi 806391a6 7408 je nt!DbgkpSendApiMessage+0x16 (806391b0) lkd> uf DbgkpSendApiMessage nt!DbgkpSendApiMessage: 8063919a 8bff mov edi,edi 8063919c 55 push ebp 8063919d 8bec mov ebp,esp 8063919f 53 push ebx 806391a0 33db xor ebx,ebx 806391a2 385d0c cmp byte ptr [ebp+0Ch],bl 806391a5 56 push esi 806391a6 7408 je nt!DbgkpSendApiMessage+0x16 (806391b0)
nt!DbgkpSendApiMessage+0xe: 806391a8 e88b010000 call nt!DbgkpSuspendProcess (80639338) 806391ad 88450c mov byte ptr [ebp+0Ch],al
nt!DbgkpSendApiMessage+0x16: 806391b0 8b5508 mov edx,dword ptr [ebp+8] 806391b3 c7421c03010000 mov dword ptr [edx+1Ch],103h 806391ba 64a124010000 mov eax,dword ptr fs:[00000124h] 806391c0 8b4844 mov ecx,dword ptr [eax+44h] 806391c3 33c0 xor eax,eax 806391c5 40 inc eax 806391c6 8db148020000 lea esi,[ecx+248h] 806391cc f00906 lock or dword ptr [esi],eax 806391cf 64a124010000 mov eax,dword ptr fs:[00000124h] 806391d5 53 push ebx 806391d6 53 push ebx 806391d7 52 push edx 806391d8 50 push eax 806391d9 51 push ecx 806391da e8afedffff call nt!DbgkpQueueMessage (80637f8e) 806391df 53 push ebx 806391e0 53 push ebx 806391e1 6aff push 0FFFFFFFFh 806391e3 8bf0 mov esi,eax 806391e5 e89651ecff call nt!ZwFlushInstructionCache (804fe380) 806391ea 385d0c cmp byte ptr [ebp+0Ch],bl 806391ed 7405 je nt!DbgkpSendApiMessage+0x5a (806391f4)
nt!DbgkpSendApiMessage+0x55: 806391ef e866010000 call nt!DbgkpResumeProcess (8063935a)
nt!DbgkpSendApiMessage+0x5a: 806391f4 8bc6 mov eax,esi 806391f6 5e pop esi 806391f7 5b pop ebx 806391f8 5d pop ebp 806391f9 c20800 ret 8
|