Hiding
Userland API Hooking: How Windows Ring 3 Rootkits Hide
How user-mode Windows rootkits such as r77 inject into every process and hook ntdll APIs to hide files, keys and processes, the traces left and how to check.
- Goal
- Hiding
- Layer
- Userland
- Platforms
- Windows
- Also known as
- Ring 3 rootkit, API hooking, Inline API hooks
- Used by
- r77 rootkit
- Checked by
- None: no module reads its traces
Overview
A userland (ring 3) rootkit hides without entering the kernel. It injects a library into running processes and hooks the Windows API functions they use to list things: processes, files, registry keys, services, connections. Each hooked call returns its normal result minus the rootkit's own entries. Task Manager, Explorer, tasklist, reg query and PowerShell, once injected, all show the same edited picture.
The technique is older than most kernel rootkits and has two properties a responder can use. It needs no driver, so driver signing, PatchGuard and memory integrity do not stand in its way; installing it across the system does require administrative rights. And it only changes answers inside the processes it has injected, on the running system. The registry hives, the files and the task definitions on disk are untouched, so anything that reads them without asking an injected process, or reads the disk from another machine, sees everything.
On Linux the equivalent is a preload library; see dynamic linker preloading. For the kernel counterpart on Windows, see kernel hooks.
How it works
Three parts work together:
- Injection everywhere. A service process injects the rootkit library into every running process it can, then catches new ones. In r77, Elastic describes one callback that enumerates processes "every 100 ms" and injects into them, and a hook in already-infected processes that reports each new child process to the service through a named pipe.
- Hooks. Inside each process, the library patches the start of selected functions, usually in
ntdll.dll, so that calls jump to its code. r77 uses Microsoft's open-source Detours library, which exists for "monitoring and instrumenting API calls". - Filtering. The hook calls the original function and removes matching entries from the result: by name prefix, by process ID, by path or by port, according to a configuration.
The functions Elastic lists for r77 show the coverage:
| Hooked function | What disappears from results |
|---|---|
NtQuerySystemInformation | Processes, and their CPU usage |
NtQueryDirectoryFile, NtQueryDirectoryFileEx | Files and directories |
NtEnumerateKey, NtEnumerateValueKey | Registry keys and values |
EnumServiceGroupW, EnumServicesStatusExW | Services |
NtDeviceIoControlFile | Network connections, through the requests that connection-listing tools send |
NtResumeThread | Nothing hidden: used to catch child processes for injection |
Security products also place hooks in ntdll.dll to watch API calls. r77's README describes the reverse move: it loads a fresh copy of ntdll.dll from disk to remove EDR hooks before injecting. Hooks can therefore be evidence either way.
How families use it
r77 is an open-source ring 3 rootkit, public on GitHub since December 2017. Its README lists what it hides: files and directories, processes and CPU usage, registry keys and values, services, TCP and UDP connections, junctions, named pipes and scheduled tasks, by default everything whose name starts with $77. Because the code is public, it turns up inside other malware:
- a 2023 cryptomining campaign in several Asian countries, which Elastic did not attribute, hid an XMRig miner, a remote administration tool and a rogue administrator account with it;
- Securonix's OBSCURE#BAT campaign (2025) used a modified copy that hides names beginning
$nya-; - Gen Digital reported trojanized JDownloader installers, served from the project's site on 6 and 7 May 2026, that deployed r77 components with a bot.
An r77 finding identifies a tool, not an actor.
Traces it leaves
| Trace | Where | Source |
|---|---|---|
HKLM\SOFTWARE\$77stager, $77config, $77dll32, $77dll64 | SOFTWARE hive | Elastic, Gen Digital |
Service $77svc; a scheduled task starting PowerShell at boot as SYSTEM | SYSTEM hive; C:\Windows\System32\Tasks | Gen Digital; Elastic |
$nya- keys and a hidden logon task | SOFTWARE hive; Tasks folder | Securonix |
| The rootkit library injected into most processes | Memory: private, executable regions without a file behind them | Elastic |
Patched function prologues in ntdll.dll | Memory of each injected process | Elastic, r77 README |
Named pipes beginning with the prefix: $77childproc (new child processes) and $77control (commands) in the current source; $77childproc32 and $77childproc64 before August 2023 | Memory, handle tables | r77 source, current and July 2023 |
| AMSI patched in the PowerShell process | Memory | Elastic, Gen Digital, Securonix |
| Task creation, process and registry activity | Security 4698; Sysmon | Securonix notes Sysmon may still log processes the rootkit hides |
The hooks themselves leave nothing on disk; the persistence that reloads them at boot does.
How to check a host
Offline is the reliable view. Copy the SOFTWARE and SYSTEM hives, C:\Windows\System32\Tasks and the event logs, and read them on another machine:
- search key and value names for
$77,$nya-and other repeated prefixes, and for large binary values directly underHKLM\SOFTWARE; - read every task XML file for PowerShell with encoded commands, boot or logon triggers as SYSTEM, or the hidden flag;
- list services whose command line starts PowerShell or whose names start with
$; - check for a
C:\Windows\System32\CodeIntegrity\SIPolicy.p7byour organisation did not deploy, as in the JDownloader case.
A collection made on the live host is reliable only if the tool reads the files and the volume itself, not through an injected process's API calls.
Live, use the difference between views and scan process memory:
Get-ChildItem 'HKLM:\SOFTWARE' | Select-Object -ExpandProperty PSChildName
Get-ScheduledTask | Where-Object { $_.Actions.Execute -match 'powershell' } | Select-Object TaskPath, TaskName
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4698 } -MaxEvents 50
hollows_hunter64.exe
An empty result from the first two commands proves nothing on an infected host; a mismatch with the offline view is strong evidence. HollowsHunter, built on PE-sieve, scans all processes when given no target and reports hooks, in-memory patches and implanted code; expect some hits from security products' own hooks and judge each by the module the hook leads to.
Memory, with Volatility 3: windows.malware.malfind lists executable memory regions that may hold injected code, windows.malware.ldrmodules compares a process's module lists, and windows.vadyarascan runs YARA rules, such as Elastic's Windows_Rootkit_R77 rules, over process memory.
What the checker looks for
None of the checker's modules sees userland API hooking, so checks is empty. The hooks live in process memory and the persistence in the SOFTWARE hive, scheduled tasks and services, while windrivers reads kernel driver services and files and linuxkernel reads Linux kernels. One edge case: the OBSCURE#BAT variant created a driver-named service, ACPIx86, which windrivers lists if it has a driver type and flags as "An unsigned kernel driver" if the file has no signature; that flags the variant's extra file, not the hooking. For r77's persistence, use a parser of the registry hives and task files, such as the Windows Persistence tool.
Mitigation and recovery
- Prevent the install. r77 needs administrative rights to inject system-wide and persist; reduce who has them. An application control policy that allows only approved code stops the installer and stager. The stager patches AMSI in its own PowerShell process before loading code (Elastic, Gen Digital, Securonix), so do not rely on AMSI alone.
- Detect the behaviour. Elastic lists the behaviour rules that fire on r77, such as parent process ID spoofing and unusual parent-child relationships, and publishes YARA rules.
Recovery: collect the hives, the task folder, the logs and, if possible, a memory image. The project ships an uninstaller, but on a host where a modified copy ran it cannot be trusted to remove the variant's additions. Gen Digital's advice for the JDownloader case applies generally: treat the system as compromised and reinstall Windows. Then deal with what the rootkit was hiding, the miner, remote access tool, bot or rogue account, and change passwords from a clean device.
Sources
Primary public reports, newest first.
- 2026-05-11Inside the JDownloader Supply-Chain Attack: An r77 Rootkit Bot That Kills Your AntivirusGen Digital
- 2025-03-13Analyzing OBSCURE#BAT: Threat Actors Lure Victims into Executing Malicious Batch Scripts to Deploy Stealthy RootkitsSecuronix
- 2023-05-22Elastic Security Labs steps through the r77 rootkitElastic
- 2018-01-11HollowsHunterhasherezade (GitHub)
- 2017-12-17r77-rootkit (public repository)GitHub
- 2016-10-19DetoursMicrosoft (GitHub)
See also
Related techniques
Families that use it
- r77 rootkitWindows user-mode rootkit