Malicious or abused driver
Netfilter Driver: Microsoft-Signed Rootkit Traces and Checks
Netfilter, the WHCP-signed rootkit G DATA found in 2021: the AppData driver, root certificate, proxy setting and service key, how to check a host, removal.
- Kind
- Malicious or abused driver · Kernel layer
- Platforms
- Windows
- First seen
- 2021
- Status
- Historical
- Checked by
- Windows drivers
Overview
Netfilter is a Windows kernel driver that G DATA reported in June 2021 after its own alerting flagged a Microsoft-signed file as a possible false positive. It was not one. The driver redirected network traffic, installed a root certificate and set a proxy configuration, all on instructions from a command-and-control (C2) server, and it could replace itself with newer versions.
The signature was the news. Microsoft confirmed that the actor had submitted the drivers for certification through the Windows Hardware Compatibility Program (WHCP), that a third party had built them, and that it saw no evidence that the WHCP signing certificate had been exposed. It suspended the account, reviewed the account's other submissions and added detections to Microsoft Defender.
Scope, as Microsoft described it:
- the goal was to spoof geo-location so that players could cheat in games and play from anywhere;
- the activity was limited to the gaming sector in China and did not appear to target enterprises;
- Microsoft did not attribute it to a nation-state actor;
- the attacker needed administrative rights to run the installer, or had to persuade a user to run it.
Intezer found related samples dating back to March 2021. In July 2023 Netfilter was among the rootkit families in a set of 133 malicious drivers that Sophos reported to Microsoft; Microsoft untrusted those drivers in its 11 July 2023 updates (advisory ADV230001). Trend Micro places Netfilter at the start of a series of WHCP abuses aimed at the same gaming community, followed by FiveSys and a 2023 rootkit loader it ties to the FiveSys actor, not to Netfilter.
The status here is historical: the public reporting is from 2021 to 2023 and the signatures have been revoked. The case still matters because it shows that a valid Microsoft signature on a driver is not evidence that the driver is benign.
How it loads and hides
Netfilter is a "bring your own" signed driver rather than an exploit. As G DATA and Microsoft describe it:
- An installer (dropper) running with administrative rights writes the driver to the user's roaming profile,
%APPDATA%\netfilter.sys. - It writes a script for
regini.exe, the built-in registry editing tool, into%TEMP%and runs it to register the driver. Microsoft says the installer updates the registry so that the driver is installed on the next boot. - On load, the driver creates the device
\??\netfilter. Its own description calls it a "WFP application layer enforcement callout driver": a network filter built on the Windows Filtering Platform, the interface Windows provides for firewalls and traffic inspection. - It contacts its C2 server for a list of IP addresses to redirect, a proxy auto-configuration URL and a root certificate.
Because the driver carried a WHCP signature, driver signature enforcement accepted it. That is the whole of its "bypass": no protection was disabled. It hid little beyond obfuscating its strings with XOR; the files and registry entries stay visible to normal tools.
Traces on disk
| Location | What | Source |
|---|---|---|
C:\Users\<user>\AppData\Roaming\netfilter.sys (%APPDATA%) | The driver. NCC Group also lists Sdl.sys and File.sys as file names | G DATA, NCC Group |
%TEMP%\c.xalm (the report also spells it x.calm) | The regini.exe script that registers the driver | G DATA |
HKLM\SYSTEM\CurrentControlSet\Services\<name> | The driver's service entry, written by the installer; no service name is published | Microsoft |
HKLM\SOFTWARE\Microsoft\SystemCertificates\ROOT\Certificates\ | A root certificate fetched from the C2 server | G DATA |
...\Software\Microsoft\Windows\CurrentVersion\Internet Settings, value AutoConfigURL | A proxy auto-configuration URL fetched from the C2 server; the report does not state the hive | G DATA |
| Prefetch, Security event 4688 | Execution of regini.exe and of the installer | NCC Group, from general hunting guidance |
The driver's signer chains to Microsoft. Mandiant's guide to attestation-signed drivers explains why such files show Microsoft Windows Hardware Compatibility Publisher as the signer and how to read the submitting organisation from the signature.
The C2 addresses and file hashes are listed in the Microsoft and G DATA reports linked above; use them from there, not from copies.
How to check a host
The strongest single signal is location: a kernel driver loading from a user profile. Legitimate drivers live in C:\Windows\System32\drivers, the DriverStore or a vendor folder under Program Files.
Offline, from a disk image or a triage collection:
- In the SYSTEM hive, list every service with
Type1 or 2 and read itsImagePath. Any path underUsers\,AppDataorTempis a finding. Note the key's last-write time. - Search the file system for
.sysfiles outside the usual driver folders, and check their signatures. - In the SOFTWARE hive, list the subkeys of
Microsoft\SystemCertificates\ROOT\Certificatesand compare them with a clean build of the same Windows version. - In each
NTUSER.DAT(and the.DEFAULThive), readSoftware\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL. - Look for
REGINI.EXEin Prefetch and in process creation events, and for the 7045 "service installed" event in the System log.
Live, from an elevated prompt:
driverquery /v /fo csv > drivers.csv
Get-CimInstance Win32_SystemDriver | Where-Object PathName -match '\\Users\\|\\Temp\\' | Select-Object Name, State, StartMode, PathName
Get-ChildItem Cert:\LocalMachine\Root | Select-Object Subject, Thumbprint, NotBefore
Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name AutoConfigURL -ErrorAction SilentlyContinue
sigcheck64.exe -accepteula -tv
sigcheck -tv lists certificates in the machine store that are not rooted to Microsoft's certificate trust list. A WHCP signature on a driver tells you who submitted it to Microsoft, not that it is safe: check the driver against Microsoft's detections and the revocations of July 2023, and against the hunting heuristics in the BYOVD hunting guide. The kernel drivers artifact page on Windows Forensics lists the related logs and their retention.
What the checker looks for
The windrivers module is the one that can see Netfilter:
- it lists the driver service from the SYSTEM hive and raises "A driver service loads its image from
C:\Users" when theImagePathpoints into a user profile such asAppData\Roaming, where kernel drivers do not belong; a recently written key can add "A driver service written shortly before the latest activity on the host"; - it reads the
.sysfile, when it is collected. Its hashes are compared with the LOLDrivers snapshot, which holds entries namednetfilter.sys; a match raises a LOLDrivers finding with the entry's name and category. Its signer is reported as a Microsoft WHQL or attestation signature, a fact rather than a sign of safety. A copy in a user folder that no service names raises "A driver file in a writable folder"; - with the System log, it raises "A kernel driver service was installed" for a 7045 event. G DATA describes the driver being registered with a
regini.exescript, which writes the registry directly and may leave no such event.
The checker does not read the certificate store in the SOFTWARE hive or the proxy setting in user hives, so the root certificate and AutoConfigURL must be checked by hand. Beyond the LOLDrivers snapshot it holds no list of Netfilter hashes, and it does not check whether a signature was revoked. The esp, measuredboot and bootsector modules have nothing to see: Netfilter does not touch the boot chain.
Removal and recovery
- Preserve first: export the service key and
Internet Settings, copy the driver file and the root certificate, and keep the event logs. - Make sure Microsoft Defender or your EDR has current signatures and that the July 2023 Windows updates are installed: they untrust the drivers that Sophos reported, Netfilter variants included.
- Remove the service entry and reboot so the driver is no longer loaded, then delete the file, the
reginiscript, the root certificate and theAutoConfigURLvalue. See the cleanup steps on the kernel drivers technique page. - Find the installer. Microsoft notes that an administrator had to run it, so work out how it arrived: a game add-on, a cheat tool, or an intruder with administrative rights.
- The root certificate allowed interception of TLS traffic, and Microsoft notes that the actor may also have used keyloggers against other players' accounts. Rotate passwords and session tokens used from the host while it was infected.
Kernel code ran with full control of the machine. On a managed or sensitive system, rebuild rather than trust a cleaned installation.
Sources
Primary public reports, newest first.
- 2023-07-11Microsoft Revokes Malicious Drivers in Patch Tuesday CullingSophos
- 2023-07-11Hunting for A New Stealthy Universal Rootkit LoaderTrend Micro
- 2021-08-10Fast Insights for a Microsoft-Signed Netfilter RootkitIntezer
- 2021-07-16Detecting and Hunting for the Malicious NetFilter DriverNCC Group
- 2021-06-25Investigating and Mitigating Malicious DriversMicrosoft
- 2021-06-25Microsoft signed a malicious Netfilter rootkitG DATA
See also
Related families
- POORTRY / BURNTCIGARMalicious or abused driver
- FudModuleWindows kernel rootkit
- DemodexWindows kernel rootkit