https://github.com/S12cybersecurity/S12URootkit
This video shows how Loki Rat hides running processes using a user-land rootkit technique.
A rootkit is a set of methods that hides files, registry keys, or processes to avoid detection by users or security tools.
The goal is to hide malicious processes—like usermodkit.x—from:
Task Manager
Process Explorer
Process Hacker
This way, even if the malware is active, it won’t be visible in any standard process list.
DLL Injection
Loki Rat injects a malicious DLL into a target process.
In this case, the DLL is injected into Task Manager itself.
Function Hooking
The malware hooks the NtQuerySystemInformation function.
This Windows API is responsible for listing all running processes.
Process Filtering
When a tool like Task Manager asks for the process list, the hook intercepts the request.
The custom hook function removes any matching hidden processes before sending the data back.
Result: The system acts like those processes never existed.
API Hooking Library:
Loki Rat uses Microsoft Detours to redirect API calls.
Hook Setup Location:
Inside the DllMain() function during the DLL_PROCESS_ATTACH event.
Steps to Hook:
Use GetModuleHandle() and GetProcAddress() to get the original address of NtQuerySystemInformation.
Start a Detours transaction.
Attach the custom function.
Commit the transaction.
Inside the Hook:
First, the original NtQuerySystemInformation is called to get all processes.
Then, it checks each process name against a list of names to hide (stored in an array or vector).
Matches are removed from the list.
Finally, the cleaned-up process list is returned.
Most antivirus and EDR systems look at processes using the same functions as Task Manager.
Since the hook alters what those tools receive, it becomes much harder to detect the malware.
This method works especially well against basic and mid-level defenses.
Run the user-mode rootkit binary (UserRootkit.exe).
This must be run as administrator.
Once it’s running, you can send commands to hide specific processes.
Even with Task Manager open, the hidden processes will not appear.
Note: Debugging this from Visual Studio is difficult because the DLL is injected into another process.
The process hiding technique in Loki Rat uses:
DLL Injection
Function hooking with Detours
Memory filtering of process lists
This keeps malicious processes hidden from users and tools that rely on standard system APIs.
It’s a powerful way to stay invisible in plain sight.