Windows kernel rootkit
Demodex Rootkit (GhostEmperor): Traces and Offline Checks
Demodex, the GhostEmperor kernel rootkit loaded through Cheat Engine's signed driver: service DLLs, registry payloads, what it hides and how to check a host.
- Kind
- Windows kernel rootkit · Kernel layer
- Platforms
- Windows
- First seen
- 2020-07
- Status
- In the wild
- Also known as
- GhostEmperor rootkit
- Checked by
- Windows drivers
Overview
Demodex is a Windows kernel-mode rootkit that Kaspersky described in September 2021 as part of the toolset of GhostEmperor, which it called a formerly unknown Chinese-speaking threat actor. Kaspersky based the language assessment on the open-source tools the actor favoured and on artefacts in its samples, and it did not tie GhostEmperor to a known group, though it noted code shared with an older Derusbi sample and a possible, unconfirmed overlap with another actor.
What Kaspersky reported:
- Targets: mainly government entities and telecommunication companies in Southeast Asia (Malaysia, Thailand, Vietnam, Indonesia), with further victims in Egypt, Ethiopia and Afghanistan.
- Timeline: the toolset was in use as early as July 2020.
- Initial access: mostly public-facing servers (Apache, IIS, Oracle application servers). One Exchange server was infected on 4 March 2021, two days after Microsoft patched ProxyLogon, which Kaspersky considers a possible entry point.
- Purpose: long-term, stealthy access. The rootkit hides the malware's files, registry keys, service and network connections from the system and from security tools.
In July 2024 Sygnia reported a new infection chain from a late-2023 incident, in which a client's network was used to reach a business partner. The rootkit was largely an updated variant of the one Kaspersky described; the loader and its file and registry names were new. Sygnia linked it to GhostEmperor on the strength of that resemblance and presented it as a variant; it did not independently establish who was behind the 2023 activity.
How it loads and hides
Both chains have the same shape: a script installs a service whose DLL decrypts a payload stored in the registry, runs an implant in memory, and that implant loads the kernel driver.
| Stage | Kaspersky (2021) | Sygnia (2024) |
|---|---|---|
| Installer | PowerShell dropper that needs a key supplied by the operator; writes encrypted data to the registry and installs a service | Batch file run through WMI; expands a CAB file and imports two .REG files; encrypted PowerShell creates the service |
| Service | A service DLL hosted by svchost.exe | Service WdiSystem in a rogue svchost group WdiSystemhost, whose name differs from the real WdiSystemHost only by case |
| Payload | Decrypted from the registry and injected into a new svchost.exe; a later stage goes into winlogon.exe | Decrypted from the registry values AKey and inputlog and reflectively loaded |
| Kernel | Demodex | Demodex, updated |
Getting past driver signing. Demodex itself is not signed. To load it, the implant drops the signed driver of Cheat Engine, an open-source game-cheating tool, under a random file name (with Cheat Engine's kernelmoduleunloader.exe and a .sig file in Kaspersky's case) and uses that legitimate driver's own features to map the rootkit into the kernel. Kaspersky notes that this works without modifying Code Integrity, so driver signature enforcement stays on; it is a signed-driver abuse in the BYOVD family rather than an exploit. Sygnia names the driver dbk64.sys and saw the same approach in 2023.
Hiding. Kaspersky describes the rootkit:
- removing the malware's service from the service list held by
services.exe; - attaching a file system filter to NTFS volumes so that the malware's files cannot be listed or opened;
- filtering registry enumeration of the malware's service key and refusing changes under
HKLM\SYSTEM; - removing TCP connections on a configured port range from tools such as
netstat; - erasing its own PE header in memory and disguising some of its registry callbacks as belonging to
pci.sys, which makes it hard to find with WinDbg or Volatility's driver scan.
Kaspersky found that Demodex was designed for Windows 10 and checked for recent builds.
Traces on disk
| Location | What | Source |
|---|---|---|
Services MsMp4Hw (C:\Windows\System32\msmp4dec.dll), Msdecode (C:\ProgramData\Microsoft\Network\Connections\msdecode.dll), AuthSvc (C:\Windows\System32\AuthSvc.dll) | Service DLLs of the 2021 chain | Kaspersky |
HKLM\SOFTWARE\Microsoft\ entries hiaudio, midihelp, data, update | Encrypted payloads | Kaspersky |
A .sys file with a random name, plus kernelmoduleunloader.exe and a .sig file | Cheat Engine's signed driver and helper, used to load Demodex | Kaspersky |
C:\Windows\vss\1.bat, C:\Windows\Web\1.cab | Installer of the 2023 chain | Sygnia |
C:\Windows\Web\prints1m.dll, Service.ps1, config.REG, AesedMemoryBinX64.REG | Service DLL, encrypted script and registry exports extracted from the CAB | Sygnia |
HKLM\SYSTEM\CurrentControlSet\Services\WdiSystem, Parameters\ServiceDll | The 2023 service, pointing to prints1m.dll | Sygnia |
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost, value WdiSystemhost | Rogue service group | Sygnia |
Registry values AKey, inputlog | AES key and encrypted implant | Sygnia |
The Demodex driver's own file name is not published in either report; in memory its driver object was \driver\dump_audio_codec0. Hashes and network indicators are in the two reports.
How to check a host
On a live host with Demodex loaded, the service, its registry key, its files and its connections may be hidden from every tool that asks Windows. Work from offline copies.
Offline, from a disk image or hives copied from a shadow copy:
- In the SYSTEM hive, list every service whose
ImagePathissvchost.exeand readParameters\ServiceDll. Flag DLLs outsideSystem32, names that imitate Windows components, and groups that do not exist on a clean build. Compare theSvcHostgroups in the SOFTWARE hive, case included. - In the SOFTWARE hive, look for large binary values under
Microsoft\and for the value names above. - Look for kernel driver services and
.sysfiles that are not part of Windows or of installed hardware, and check their signers. A Cheat Engine driver on a server is a finding on its own, as Sygnia notes. - In the file system timeline, look at
C:\Windows\Web,C:\Windows\vss,C:\Windows\debugandC:\ProgramData\Microsoft\Network\Connectionsfor recent DLLs, scripts and.REGfiles. - In event logs: 7045 for new services, 4697 if security system extension auditing is on, and WMI process creation followed by
expand.exeandreg.exe.
Live, for comparison with the offline view (a difference is itself evidence):
Get-CimInstance Win32_Service | Where-Object PathName -match 'svchost' | Select-Object Name, PathName, StartMode
Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\*\Parameters' -Name ServiceDll -ErrorAction SilentlyContinue | Select-Object PSChildName, ServiceDll
driverquery /v /fo csv > drivers.csv
Because Demodex hides in memory as well as on disk, a memory image analysed off the host is the way to confirm it is loaded. The Windows services technique page explains service DLL persistence, and the services artifact page lists where service evidence lives.
What the checker looks for
The windrivers module reads the SYSTEM hive and driver files from the collection, outside the running system, so the rootkit's hiding does not apply to it:
- Cheat Engine's signed driver, whatever its random name. Its hashes are compared with the LOLDrivers snapshot, which lists
dbk64.sysas a vulnerable driver, so a matching sample raises "A known vulnerable driver (LOLDrivers): dbk64.sys". Its signer is shown; a valid signature is not a finding in itself. If a service for it remains, it is listed with itsImagePath, and a path in a writable folder is flagged; - with the System log, "A kernel driver service was installed" for the 7045 event of that service, if it was created through the Service Control Manager.
It lists only driver services, so it does not judge svchost service DLLs, SvcHost groups or encrypted payloads in the SOFTWARE hive: check those by hand as described above. It cannot see the Demodex driver itself, which is mapped into memory through the signed driver and has no service of its own in the published reports. The boot-chain modules (esp, measuredboot, bootsector) have nothing to see.
Removal and recovery
- Do not trust the running system. Acquire memory and disk first, and examine them elsewhere.
- Rebuild affected servers from known-good media. The rootkit hid itself, the implant lived in memory and the registry, and the actor had administrative access for long periods: deleting the visible pieces from a live system cannot establish that the host is clean.
- Find the way in. Kaspersky saw public-facing servers exploited, and Sygnia saw movement from one organisation to a partner: patch exposed services and review trust relationships with other networks.
- Rotate credentials used on or stored on affected hosts, including service accounts and domain accounts that logged on.
- Block Cheat Engine's driver where it has no business: Windows Defender Application Control or your EDR's driver control can refuse it by signer or hash.
Sources
Primary public reports, newest first.
- 2024-07-17The Return of Ghost Emperor's DemodexSygnia
- 2021-09-30GhostEmperor: From ProxyLogon to kernel modeKaspersky
See also
Related families
- SnakeWindows kernel rootkit
- FudModuleWindows kernel rootkit
- Netfilter driverMalicious or abused driver