检查 API 是否受到监控(挂钩?)
我的应用程序使用一些 API,例如 GetProcAddress
和 CreateProcess
,这些 API 有时会导致防病毒软件将其标记为恶意软件,尽管事实并非如此。
我想做的是检查特定的 API 是否正在被监视或挂钩,如果是,那么我不会调用该部分代码。
如何检查某个API是否被hook?
这是一个用 C 语言编写的 Windows 应用程序
。谢谢。
My application uses some APIs like GetProcAddress
and CreateProcess
that cause sometimes antiviruses to flag it as malicious even though it is not.
What I am trying to do is check whether a specific API is being monitored or hooked and if it is then I won't call that part of the code.
How do I check whether a certain API is hooked?
This is a Windows application written in C.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 win32 上,没有官方方法来检测和/或放置挂钩(除了
SetWindowsHookEx()
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990) 等al 函数仅涵盖一小部分功能)。检测钩子取决于钩子的应用方式。
有两种流行的方法来放置挂钩:
有关放置挂钩的不同方法的详细信息(优点/缺点),请考虑阅读此处 http://help.madshi.net/ApiHookingMethods.htm。
每种挂钩方法都需要不同的方法来检测它。
有关检测如上所述放置的挂钩的方法,请在此处的“ApiHookCheck 算法”下查看 http:// www.security.org.sg/code/apihookcheck.html。此页面上有可用的示例源,但我没有对其进行测试。
On win32 there are no offical methods to detect and/or place hooks (besides the
SetWindowsHookEx()
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990) et al functions which only cover a very small set of functionality).Detecting a hook depends on how the hook was applied.
There are two popular methods to place a hook:
For details (pros/cons) on the different methods to place hooks please consider reading here http://help.madshi.net/ApiHookingMethods.htm.
Each method of hooking requieres a different approach to detect it.
For methods to detect hooks placed as mentioned above please look under "ApiHookCheck Algorithm" here http://www.security.org.sg/code/apihookcheck.html. There are sample sources available on this page, which I did not test.