Hiding
Filter Drivers as Rootkits: Minifilters and WFP Callouts
How Windows rootkits use file system filters, registry filters and WFP callout drivers to hide files and steer traffic, and how responders list and check them.
- Goal
- Hiding
- Layer
- Kernel
- Platforms
- Windows
- Also known as
- Minifilter, WFP callout driver, Legacy file system filter, Registry filter
- Used by
- DemodexNetfilter driver
- Checked by
- Windows drivers
Overview
Windows lets drivers sit in the path of input and output by design. A file system filter sees every request to a volume before the file system does; a Windows Filtering Platform (WFP) callout driver inspects or changes network traffic; a registry filtering driver is called on registry operations. Antivirus, EDR, backup, encryption and firewall products are built on these interfaces. When Microsoft introduced Kernel Patch Protection, it pointed vendors to exactly these supported alternatives to kernel patching: WFP, the file system minifilter model and registry notification (Microsoft).
A rootkit can use the same interfaces. A file system filter can make files impossible to list or open; a registry filter can hide keys and refuse changes; a WFP callout can redirect connections. Because the interfaces are documented, such a driver does not trip PatchGuard or memory integrity; it only needs to be loaded, which brings it back to signatures, as with malicious drivers with valid signatures or a vulnerable driver. The same interfaces are also what attackers remove to blind security products: see removing kernel notification callbacks.
How it works
| Kind | How it registers | Registry traces | How responders list it |
|---|---|---|---|
| File system minifilter | With Filter Manager (FltRegisterFilter), at an altitude | Service with Type 2, a Group such as FSFilter Activity Monitor, Instances\<name>\Altitude | fltmc filters, fltmc instances |
| Legacy file system filter | Creates a device object and attaches it to a file system's device stack; learns of new file systems through IoRegisterFsRegistrationChange | A driver service | Device stacks in memory |
| Registry filter | CmRegisterCallback(Ex); Microsoft calls these registry filtering drivers | A driver service | Callbacks in memory |
| WFP callout | Callout functions registered with the filter engine at kernel-mode filtering layers (Microsoft), referenced by filters | A driver service, usually Type 1 | netsh wfp show state; Security events 5440 and 5446 |
Altitudes. Each minifilter has an altitude that sets its place in the stack, inside the range of its load order group: for example 320000 to 329999 for FSFilter Anti-Virus and 360000 to 389999 for FSFilter Activity Monitor. Microsoft allocates altitudes to vendors and publishes the allocated list (Microsoft). A filter whose name and altitude do not match that list is a lead.
Imports. A driver's import table tells what it is: minifilters call Filter Manager routines exported by FltMgr.sys, and WFP callout drivers link against Fwpkclnt.lib (Microsoft), so their imports usually name fwpkclnt.sys.
Effect. A filter sees every request before the component below it. It can fail a request (a file "does not exist"), edit the answer (an entry removed from a directory listing), or change the request (a connection sent elsewhere). User-mode tools have no view below the filter: they get whatever it returns.
How families use it
Demodex. Kaspersky's GhostEmperor report describes three kernel filtering features:
- A legacy file system filter. On request, the rootkit registers a file system filter driver's notification routine; for NTFS volumes it "creates a device object for the rootkit which is attached to the subject file system's device stack". Listing, opening or changing a hidden file then fails with errors such as
STATUS_NO_MORE_FILESorSTATUS_NO_SUCH_FILE. - A registry filter. It hides the malware's service key "by hooking several registry operations through the CmRegisterCallback API" and refuses changes under
HKLM\SYSTEM. The callback address it registers lies at the end of the executable section ofpci.sys, patched with a stub that jumps to the real code, so the callback appears to belong to a Windows driver. - Its connection hiding is a dispatch hook rather than a filter; see kernel hooks.
Netfilter. G DATA's report identifies the driver as a "WFP application layer enforcement callout driver". On instructions from its server it redirected traffic for a list of IP addresses, and it was accompanied by a root certificate and a proxy auto-configuration setting. Microsoft says the goal was geo-location spoofing for game cheating. The driver carried a WHCP signature, so nothing had to be disabled for it to load.
A contrast: FudModule. It works on the other side: Avast reports it unlinking the minifilter callbacks of security products in the antivirus and activity-monitor altitude ranges, and tampering with WFP callouts. That is callback removal.
Traces it leaves
| Trace | Where | Notes |
|---|---|---|
| Driver service | SYSTEM hive, Services\<name> | Type 2 for file system filters; Group, Instances and Altitude for minifilters; ImagePath and key times |
| Driver file | Where ImagePath points | Netfilter: %APPDATA%\netfilter.sys (also Sdl.sys, File.sys per NCC Group); Demodex's driver name is not published |
| Imports | The driver's PE import table | FLTMGR.SYS for minifilters, fwpkclnt.sys for WFP callouts |
| WFP audit events | Security.evtx | 5440 lists callouts present when the Base Filtering Engine starts; 5446 records a callout change; both need "Audit Filtering Platform Policy Change" (Microsoft) |
| Install events | System 7045 | New driver services |
| Netfilter side effects | SOFTWARE\Microsoft\SystemCertificates\ROOT\Certificates; AutoConfigURL in user hives | Root certificate and proxy setting |
| In memory | Device stacks, registry callbacks, WFP callouts | Demodex's attached device and its registry callback disguised as pci.sys |
How to check a host
Offline, from the SYSTEM hive and the driver files:
- List services with
Type2 and with aGroupbeginningFSFilter; readInstances\*\Altitudeand compare name and altitude with Microsoft's allocated list. - For every third-party kernel driver, read its imports:
FLTMGR.SYSorfwpkclnt.sysmeans a file system or network filter, whatever its name suggests. Check its signer and its location. - For a WFP driver, check the certificate store and proxy settings in the hives for Netfilter-style side effects.
- Read Security 5440 and 5446 if Filtering Platform auditing was on, and 7045 in the System log.
Live, from an elevated prompt:
fltmc filters
fltmc instances
netsh wfp show state
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 5440, 5446 } -MaxEvents 200 -ErrorAction SilentlyContinue
Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services | Get-ItemProperty | Where-Object Group -like 'FSFilter*' | Select-Object PSChildName, Group, ImagePath
fltmc lists the minifilters and instances that Filter Manager knows (Microsoft); netsh wfp show state writes the current WFP state, callouts included, to wfpstate.xml (Microsoft). A legacy filter such as Demodex's is not a minifilter, and a rootkit that controls the kernel can hide its own service key, as Demodex did.
Memory, with Volatility 3: windows.devicetree shows device stacks and attached devices, windows.callbacks lists registry callbacks and file system registration notifications with their owning module, and windows.driverirp shows dispatch routines. Demodex's registry callback appeared to belong to pci.sys because its address lay at the end of that driver's code section, where the rootkit had written a jump stub: compare the code at such an address with the file on disk.
What the checker looks for
The windrivers module lists every driver service with Type 1, 2 or 8 from the SYSTEM hive, so filter drivers appear in its list with their type, start, ImagePath and Group, read outside the running system where a registry filter cannot hide them:
- a filter loaded from a user profile, as Netfilter was, raises "A driver service loads its image from" that folder, and a copy that no service names raises "A driver file in a writable folder";
- the file's signer is shown, a Microsoft WHQL or attestation signature included; a hash match in its LOLDrivers snapshot, which holds a
netfilter.sysentry filed as a vulnerable driver, raises a LOLDrivers finding; - the detail sheet lists the driver's imports, where
FLTMGR.SYSorfwpkclnt.sysshows what kind of filter it is; - 7045 events raise "A kernel driver service was installed".
It does not read Instances or altitudes, does not judge a driver for being a filter, and does not read WFP state, audit events, the certificate store or proxy settings. A legacy filter device, a registry callback or a WFP callout exists only in memory; Demodex's own driver has no published service or file name.
Mitigation and recovery
Filtering is a legitimate feature, so there is nothing to switch off. Control who can add a filter:
- Driver control. An App Control for Business policy that allows only known driver signers and hashes stops an unexpected filter driver, even one with a valid signature.
- Signatures and blocklist. Memory integrity (HVCI) with the vulnerable driver blocklist keeps out known bad and vulnerable drivers; Microsoft revoked the Netfilter drivers and added detections.
- Baselines. Keep a list of expected minifilters, altitudes and WFP callouts per build, and turn on Filtering Platform Policy Change auditing where the volume is acceptable.
Recovery: preserve the driver, its service key and the logs; remove the service and reboot, then the file; for a Netfilter-type driver, also remove the root certificate and proxy setting and rotate credentials and session tokens used while traffic could be intercepted. A filter driver ran in the kernel with full control: rebuild the host rather than trust a cleaned one.
Sources
Primary public reports, newest first.
- 2025-04-24Load Order Groups and Altitudes for Minifilter DriversMicrosoft
- 2024-02-28Lazarus and the FudModule Rootkit: Beyond BYOVD with an Admin-to-Kernel Zero-DayAvast
- 2021-09-30GhostEmperor: From ProxyLogon to kernel modeKaspersky
- 2021-09-06Audit Filtering Platform Policy ChangeMicrosoft
- 2021-06-25Microsoft signed a malicious Netfilter rootkitG DATA
- 2021-06-25Investigating and Mitigating Malicious DriversMicrosoft
- 2006-08-12An Introduction to Kernel Patch ProtectionMicrosoft
See also
Related techniques
- Removing kernel notification callbacksBlinding defences
- Kernel hooks on Windows (inline, SSDT, IRP)Hiding
- Malicious drivers with valid signaturesGetting into the kernel
- Bring your own vulnerable driver (BYOVD)Getting into the kernel
Families that use it
- DemodexWindows kernel rootkit
- Netfilter driverMalicious or abused driver