New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling NtQuerydirectoryFile from a Kernel Hook Crashes the Kernel #78
Comments
I could track the problem to trashing the RAX register in the trampoline code. I'm currently replacing it with a safer version... |
Thanks @fifothekid, please let me know how u go.
|
It looks like the BuildQueryDirectoryIrp function expects some kind of parameter
with this:
|
It worked |
@fifothekid great news. Can I ask are you doing anything for patchguard etc.. Or just enabled kernel debugging? |
I'm sure that I've enabled kernel debugging, but I don't think that I've done anything to Patchguard, although I remember tinkering with many Windows options |
@fifothekid in that case there will be various parts of the kernel that are protected by Patch Guard, so just keep that in mind when it comes to deploying. I believe that some hooks are still possible (e.g. perhaps other kernel driver callbacks). Please let me know when you have your pull ready. |
@fifothekid do you happen to have that pull request ready? |
I'm currently working on a program that uses hooks at the same function (via user-mode). Any updates about this bug? |
@alvin-nt committed a fix in develop branch |
I'm using the latest version of EasyHook to hook some kernel functions. I did setup a debugging important successfully on a Windows 8.1 64-bit based virtual machine, and I tested hooking both of NtQuerydirectoryFile and NtQuerySystemInformation in user mode and NtQuerySystemInformation in kernel mode without any problem.
My current problem is hooking NtQuerydirectoryFile using the same code that I used for the user mode hook, but it fails when I call the original function giving me an access violation error. I'm using the following code for the kernel mode hook:
And here's the dump:
The text was updated successfully, but these errors were encountered: