Posted July 2, 200916 yr Anyone have an example of hooking a kernel32 api with a driver?Also can more than one driver hook an api at a time?Side question: Can you call a drivers functions directly? Or do you have to do the Read/Write file stream?
July 3, 200916 yr Author How do you have a dll load in every process without just creating a remote thread in every process?Also I kinda want to do it with a driver that way another dll cannot override the hook.
July 3, 200916 yr You could try this method - http://support.microsoft.com/kb/197571dlls specified in that reg entry are loaded into every process (assuming user32.dll is loaded)
July 3, 200916 yr Even if another dll overwrites the hook, what it does is overwrite your JMP with another JMP to its own stub.After that it restores the old instruction and calls the API. So it basically restores your own hook again.Even if it copies the instructions it overwrites to its stub, it will still execute the old JMP. (given it can relocate relative jmps/calls)I'm not even sure what a difference a driver would make. It still has to modify userland memory which can still be overwritten by a dll.Unless you monitor and suppress changes to your hook in memory with your driver, it won't give you any extra protection. Let alone the effort of building a stable driver.
July 3, 200916 yr Author Even if another dll overwrites the hook, what it does is overwrite your JMP with another JMP to its own stub.After that it restores the old instruction and calls the API. So it basically restores your own hook again.Even if it copies the instructions it overwrites to its stub, it will still execute the old JMP. (given it can relocate relative jmps/calls)I'm not even sure what a difference a driver would make. It still has to modify userland memory which can still be overwritten by a dll.Unless you monitor and suppress changes to your hook in memory with your driver, it won't give you any extra protection. Let alone the effort of building a stable driver.I guess you are right.But ya, what I want to do is hook an API and block calls to it. That is why I want my dll on top of everything. I guess I could have a thread running in the background that will detect if the hook is tampered with and repair it if it is.
Create an account or sign in to comment