-
Notifications
You must be signed in to change notification settings - Fork 403
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
HookedNtEnumerateKey CPU Overhead?? #90
Comments
The issue with the implementation is that So, for a key with 10 sub keys, this function is called up to 10 times, just to retrieve a sub key (without any rootkit installed). Let's say a registry key has 10 sub keys and the third and forth are hidden. Then This is exponentially slow and especially noticable in processes that operate a lot on the registry. Let me think about a solution, as this is clearly a nasty performance issue in some cases. If you're in a hurry and need a workaround, you can exclude specific process names, or you can de-implement the registry hooks, depending on your situation. |
I've done some prototyping so far. Would you like to assist me with the testing? I simply stored the previously accessed key and index, and the number of hidden keys before that index. Assuming that a key is enumerated "normally", this function should almost always use the cache. The cached values still need to be stored in the thread local storage. But for testing purposes, you can simply replace the two hooks with this code: Let me know what the result looks like, and if there is any stability issue.
|
Hmmm, I'm not seeing any issues with stability using that, in fact sfc /scannow is fixed when using that code. But MMC with admin tools still seems to hang and crash event viewer. What's weird is that even when I exclude MMC.exe from being injected, event viewer hangs and crashes if the rootkit is installed, but editing HookedNtEnumerateKey to do nothing but return the original value fixes it. Appreciate the help! |
I decided to leave MMC open on the hang while the rootkit was installed to see what would happen, and after about 5 minutes it finally gave me a JIT error "Item cannot be added to the ListView." ************** Exception Text ************** ************** Loaded Assemblies **************
|
I have created a new branch here with the above implementation, but using TLS. I see that sfc /scannow doesn't work at all with the current release, but it does work with the version from the new branch. Event Viewer seems to work, but only most of the times, though. Could you compile that version and try? I'm curious if this implementation is stable and solves the particular issue. |
Not noticing any changes in Event Viewer on my end, for me it still crashes no matter what. SFC /Scannow is fixed but that's all. Appreciate your help :) |
I'll still look into the issue with event viewer some time soon. In the mean time, you can grab the source code from the branch and use it. I'll post here when I'm done fixing the performance issues in EventVwr. |
Happy new year! Sorry to keep you waiting for so long... I was especially occupied with updates to some Windows Defender detections and EDR bypasses (see changelog). However, I have now released version 1.5.5 with a bugfix for |
The current implementation of HookedNtEnumerateKey seems to hang certain windows applications that use it, specifically sfc /scannow and EventViewer. Will this be fixed in future updates? If not, is there any way you can help me to improve the implementation so it doesn't hang these programs?
The text was updated successfully, but these errors were encountered: