1.ring3-反调试-IsDebuggerPresent

来源:互联网 发布:桌面会议软件 编辑:程序博客网 时间:2024/05/17 18:41

依赖于API的反调试

这个函数会看PEB中的BeingDebugged是否为0,不为0就表示无调试器,否则表示有调试器.注意的是以前代码都会对这个函数首字节是否为0x64作判断,但在win7下,需要对应kernelBase中的IsDebuggerPresent,而不是kernel32中的IsDebuggerPresent

//使用IsDebuggerPresent函数检测DbgToolType AntiDebugged::AD_IsDebuggerPresent(){HMODULE hKernelBaseDll = ::LoadLibrary(TEXT("kernelBase.dll"));if (NULL != hKernelBaseDll){// 不要使用kernel32,kernel32中IsDebuggerPresent第一条指令并非0x64FARPROC pIsDebuggerPresent = ::GetProcAddress(hKernelBaseDll, "IsDebuggerPresent");if (!pIsDebuggerPresent){::FreeLibrary(hKernelBaseDll);return DGBTOOL_NO;}if ((*(BYTE *)pIsDebuggerPresent == 0xCC)||(*(BYTE *)pIsDebuggerPresent != 0x64)|| pIsDebuggerPresent()){::FreeLibrary(hKernelBaseDll);return DBGTOOL_CUSTOM;}else{::FreeLibrary(hKernelBaseDll);return DGBTOOL_NO;}}return DGBTOOL_NO;}


这个过掉的方式比较简单:只需要把PEB中的BeingDebugged置为0.

比如直接在OD命令中输入:d fs:[30]+2把它改为1即可过掉:

 

原创粉丝点击