-
Notifications
You must be signed in to change notification settings - Fork 397
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
Hide CPU Usage Not Fully Work #53
Comments
Yeah... I'm actually aware of this issue and documented it in section 5.4 Known Issues. Most notably is that different task managers use different routines to check CPU usage. I managed to hide CPU usage in procmon and ProcessHacker, but not in TaskMgr and PerformanceMonitor. If I only knew, which API calls those are, I would probably also solve #7 (hiding GPU usage). In the past, I did some blackbox testing with TaskMgr and checked various ntdll functions that were actually imported. Some of them were called, but no matter what random data I have replaced the returned data with, it didn't change the graph at all - which means I did not hook the right function. So, starting at square one - do you or anybody who reads this have any ideas or contributions to solve this long lasting issue? I would certainly credit anybody who helps to fix bugs, even if they just know what the correct function is to hook. |
I wish I know since the same problem has bothered me for years. I wonder if it uses pdh counter data coz taskmgr loads pdh.dll,need to test it. |
Glad to hear I'm not alone... I still have the test code that I used to find the correct function to hook. These are ones that I tried:
I didn't bother to try and hook And to share my notes with you: TaskMgr calls I have also disassembled some functions of TaskMgr and everything seems to point to PDH. That's why my testing with PDH was so extensive... I even searched for examples on how to get CPU usage using PDH to get an idea of how this library is actually used. |
LONG GetCPUUsage() if (PdhOpenQuery(0,0,&hQuery) == ERROR_SUCCESS) the return value is the cpu usage.if it uses pdh,it's fine;I am afraid it uses WMI,it would be hard to hook |
In issue #9 I have found out that AIDA64 is using WMI to populate process lists and that injecting But about CPU usage... The thing is, during my tests, I only injected |
wish it works out |
Interesting... what tool is this? TaskMgr (Windows 11) definitely calls But when fuzzing this function with random values, it does not change anything in the UI - even when injecting all processes. Let me keep looking...
|
the tool is dbgview,just showing the debug output |
I spent some time playing with PDH. So far, I have successfully hidden GPU usage, which was on the ToDo list for 2 years. I have commited my work in progress on this branch: https://github.com/bytecode77/r77-rootkit/tree/PDH I hooked both This is either the wrong way to go about it - or PDH is just string cancer. I don't know yet, but I'm sharing my code with you as it contains working PDH hooks. Another issue except the excessive string use is that I would really like to see some ... In the meantime, I'll do some more research about the CPU usage. |
I tested GetSystemTimes(),doesn't use this API to get cpu usage as well. |
|
pretty much like the gpu stuff,and good luck |
GetProcessTimes API get called a lot |
PcwCollectData seem to be native call of pdhcollectquerydata |
So, being busy reverse engineering PDH, I have figured out how to hide GPU usage and released version 1.5.1 with that feature. I have implemented the hook in CPU usage is still not fixed, but I'm at least closer, because I know more about the PWC driver now. I'll pick up on that sometime next. |
good to know |
something not about the cpu usage hiding but PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY.when r77 rootkit is installed,no doubt creating new process with PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY still get injected because r77 rookit interrupts the ntresumethread call,and inject the dll before the newer created process even starts.However,I create a process with PROCESS_CREATION_MITIGATION_POLICY_BLOCK_NON_MICROSOFT_BINARIES_ALWAYS_ON before running the install.exe,the process still get injected,I wonder why. Maybe the reflective injection only inject codes other than pe files so it bypasses the check? |
I can't find out anything useful about that " |
a process with PROCESS_CREATION_MITIGATION_POLICY_BLOCK_NON_MICROSOFT_BINARIES_ALWAYS_ON set supposes to block 3rd party module injection but with Microsoft digital signature.If I inject the r77's dll with normal injection,some error windows will pop up,but it's ok using reflective injection.I assume this mechanism needs to check file for the signature,no file then no check. |
Does this "Bad Image" error ocurr when you inject using a normal injector, or does it also happen when using the reflective loader (Test Console / full installation) ? By the way, while I was working on the initial release in 2020, I only had a normal injector before I implemented the reflective injector. At least back then there were no issues injecting into any process. So I assume it's a new security measure. |
that error won't occur using test console/full installation.As long as the injection won't involve dll file on disk,no error shows up. |
It works at the details column on task manager,but at Processes,Users and Performance columns of task manager,the cpu usage remains intact.Tested On Windows 10.
SystemProcessorPerformanceInformation and SystemProcessorIdleCycleTimeInformation never gets triggered
The text was updated successfully, but these errors were encountered: