UEFI bootkit
ESPecter UEFI Bootkit: Traces and Offline Checks
ESPecter patches the Windows Boot Manager in the EFI system partition to load an unsigned driver. Its ESP, MBR, driver and config traces, checks and recovery.
- Kind
- UEFI bootkit · Boot layer
- Platforms
- Windows
- First seen
- 2012
- Status
- In the wild
- Techniques
- Replacing or patching the ESP boot managerHooking the UEFI hand-over to the OSReplacing the MBR boot codeHooking the BIOS disk service (int 13h)Hidden storage outside the partitionsTurning off driver signing from the boot chain
- Checked by
- EFI system partitionMeasured Boot logsDisk boot sectors
Where it lives in the boot chain
What this family writes or patches at each step of the boot, and which steps the checker reads.
01Firmware
Not touched02
Boot code on disk
What the firmware starts: files on the ESP, or the disk's boot sectors.
UEFI boot
Checker:EFI system partitionMeasured Boot logs
EFI system partition
bootmgfw.efi, shimx64.efi, grubx64.efi, BCD
- Patches bootmgfw.efi and bootx64.efi with an added .efi section
Legacy BIOS boot
Checker:Disk boot sectors
MBR
Sector 0: boot code and partition table
- Replaces the MBR codeLegacy version
Outside the partitions
Before the first or after the last partition
- Original MBR, code, configuration and driver from sector 1Legacy version
03
OS loader and kernel
Patched as they load; the files on disk stay unchanged.
Not on disk: needs a memory image, or the place it starts from
bootmgr, winload, GRUB; ntoskrnl.exe, the Linux kernel
- Hooks the hand-over to the OS loader; driver signing off for that boot
- OS-level traces: checked by rootkits.dev
04
Operating system
Files the bootkit writes as the system starts.
Drivers, programs, registry hives
- Writes and loads its unsigned driver, null.sys
Written herePatched in memory, files unchanged
Overview
ESPecter is an espionage bootkit for Windows that ESET described on 5 October 2021. ESET traced it back to at least 2012, when it was an MBR bootkit for legacy BIOS systems. The newer version persists on UEFI systems by patching the Windows Boot Manager on the EFI system partition (ESP). ESET counted it as only the second real-world UEFI bootkit persisting on the ESP; the other was the FinSpy bootkit that Kaspersky had described a week earlier.
The samples support Windows 7 through Windows 10. The payloads are a keylogger, screenshot capture, theft of documents (including from removable drives) and a backdoor. ESET did not attribute ESPecter to a known actor. It assessed with low confidence that the operators speak Chinese, based on Chinese debug messages in one component. The initial access method is unknown.
ESPecter does not exploit a Secure Boot flaw. The UEFI version only runs when Secure Boot is off. ESET lists the ways that could happen without knowing which applied: physical access, a machine where it was already off, or a firmware vulnerability.
How it loads and hides
UEFI version. The installer modifies the Windows Boot Manager, \EFI\Microsoft\Boot\bootmgfw.efi, and the fallback loader \EFI\Boot\bootx64.efi. ESET reports that it adds a new PE section named .efi and moves the entry point there. Because the file is changed, its Authenticode signature no longer verifies, which is why Secure Boot stops it.
At boot, the added code patches the boot manager in memory so that its own self-integrity check passes, then hooks the hand-over to the Windows OS loader and, through it, the kernel. In the kernel it patches the code integrity initialisation, which disables Driver Signature Enforcement for that boot. Nothing of this is written back to the Windows files: the changes exist only in memory, each boot.
With signature enforcement off, the bootkit writes and loads its own unsigned driver. ESET lists it as \SystemRoot\System32\null.sys for the UEFI version and describes it as replacing the legitimate Null driver (the legacy version used System32\drivers\null.sys on x64 and drivers\beep.sys on x86). The driver creates the device \Device\WebBK, sets up a keyboard filter for keylogging, injects WinSys.dll into svchost.exe and Client.dll into winlogon.exe, and then deletes itself. ESET's IOC list gives %windir%\Help\intel.chm as the path where the clean driver is backed up.
Legacy version. The MBR is replaced with code that hooks BIOS interrupt 13h to patch the Windows boot loader as it is read from disk. ESET reports the original MBR backed up in sector 1, the bootkit code in sectors 2 to 4, the encrypted configuration in sector 5 and the driver from sector 6, all in the unallocated space before the first partition. Installers copied cmd.exe under the name con1866.exe.
Traces on disk
| Location | What | Source |
|---|---|---|
ESP\EFI\Microsoft\Boot\bootmgfw.efi, ESP\EFI\Boot\bootx64.efi | Patched boot manager: extra .efi section, entry point moved, broken signature | ESET |
C:\Windows\System32\null.sys (UEFI); System32\drivers\null.sys or beep.sys (legacy) | The bootkit's driver; deletes itself after running, so may be gone | ESET |
C:\Windows\Help\intel.chm | Backup of the clean driver | ESET IOC |
C:\Windows\Temp\syslog | Encrypted configuration (UEFI version) | ESET |
HKLM\SYSTEM\CurrentControlSet\Control, value DefaultConfig | Configuration in the registry; used in preference to the file | ESET |
C:\Windows\Temp\memlog, dd_vcredist, vmmmlog, vmmmmlog | Encrypted payloads; vmmmlog.exe and vmmmmlog.exe decrypted | ESET IOC |
C:\Windows\System32\WinSys.dll, Client.dll | Decrypted user-mode payloads | ESET |
C:\Windows\System32\Media\NPCSJDLFSD or C:\Windows\Temp\NPCSJDLFSD | Hidden folder for stolen data, with SSQWCVBER (screenshots), UTXZCZXQ (documents) and KLACVSWER (keystrokes) | ESET IOC |
| Disk sectors 1 to 5 and from 6 (legacy) | Original MBR copy, bootkit code, configuration, driver | ESET |
ESET's report and its IOC repository list SHA-1 hashes of the two compromised boot managers they found, the drivers and the installers, and C&C addresses. Copy them from there if you need them.
How to check a host
Offline:
- Copy the ESP. Check the Authenticode signature of
bootmgfw.efiandbootx64.efiand their section table: a section named.efior a signature whose hash no longer matches is enough to suspect tampering. Compare them with the copies inC:\Windows\Boot\EFI\, which Windows uses as the source for the ESP. - From the system volume, look for the files in the table above, the
DefaultConfigvalue in the SYSTEM hive (ControlSet001\Control), and the stolen-data folders. - For legacy BIOS machines, image at least the first megabyte of the disk and compare the MBR with standard Windows boot code; look for data in sectors 1 to 6.
- In the Measured Boot logs (
C:\Windows\Logs\MeasuredBoot\), check whether Secure Boot was off and whether the boot manager's measurement changed between boots. See Reading Measured Boot logs.
Live, elevated:
mountvol S: /S
powershell -c "Get-AuthenticodeSignature S:\EFI\Microsoft\Boot\bootmgfw.efi, S:\EFI\Boot\bootx64.efi | Format-List Path, Status, SignerCertificate"
powershell -c "Confirm-SecureBootUEFI"
reg query HKLM\SYSTEM\CurrentControlSet\Control /v DefaultConfig
dir /a C:\Windows\Temp\syslog C:\Windows\Temp\memlog C:\Windows\Help\intel.chm
dir /a /s C:\Windows\System32\Media\NPCSJDLFSD C:\Windows\Temp\NPCSJDLFSD
mountvol S: /D
Confirm-SecureBootUEFI returns False when Secure Boot is off, which ESPecter's UEFI version needs. Running code in the kernel, ESPecter can hide or alter what these commands return; a copy of the ESP and the disk read from another system is the reliable check. The collection steps are in How to check the EFI system partition offline.
What the checker looks for
espreadsbootmgfw.efiandbootx64.efiand recomputes their Authenticode digest. A boot manager patched after signing raises "The file was changed after it was signed", linked to this page when the file has an added.efisection or its entry point in its last section, the layout ESET describes. "The entry point is in an unusual section" flags the moved entry point, and "is much newer than the other files in its folder" a patch time well after its neighbours'.measuredbootraises "Secure Boot was off during this boot", or "Secure Boot was on in the previous boot and off in this one", the condition ESPecter's UEFI version needs. When logs from before and after the patch exist, "The digest of\EFI\Microsoft\Boot\bootmgfw.efichanged since the previous boot" shows the change; Windows updates do the same, so match it with the update history.bootsector, for the legacy version, raises "MBR boot code does not match a known loader", and "Data before the first partition does not match a known loader" for the code and configuration in the sectors after the MBR. The original MBR kept there can add "Copy of a boot sector before the first partition". Only a disk read from outside the running system shows them.
ESPecter's kernel driver (System32\null.sys for the UEFI version, System32\drivers\null.sys or beep.sys for the legacy one) is a Windows driver trace, outside this checker's modules. rootkits.dev reads .sys files and flags an unsigned driver, or a signed one whose bytes changed. The driver deletes itself after running, so most collections will not hold it.
The checker does not read the DefaultConfig registry value, the Temp files or the stolen-data folders; look for those by hand. It cannot see the in-memory patches or the injected DLLs.
Removal and recovery
The bootkit's patches live in the boot manager files, but once it has run, its driver has had kernel access and its keylogger has captured whatever was typed.
- Preserve: copy the ESP, image the disk (or its first megabyte on legacy systems), and export the SYSTEM hive.
- Rebuild the host from trusted media. Replacing
bootmgfw.efifrom a clean copy, or rewriting the MBR from Windows RE (bootrec /fixmbr), removes the boot stage but leaves any user-mode payloads and changed files behind; it is acceptable only as a stopgap. - Turn Secure Boot on, and set a firmware administrator password so that it cannot be switched off without one. ESET notes that Secure Boot blocks this bootkit.
- Keep firmware up to date, and restrict administrator rights, which installing ESPecter needs.
- Rotate every credential typed or stored on the host. The keylogger and document theft mean passwords, documents and anything on attached USB drives should be treated as taken.
Sources
Primary public reports, newest first.
- 2021-10-05UEFI threats moving to the ESP: Introducing ESPecter bootkitESET
- 2021-10-05ESPecter indicators of compromiseESET
- 2021-10-05ESET Research discovers ESPecter, a UEFI bootkit for cyberespionageESET
See also
Related families
- BlackLotusUEFI bootkit
- FinSpy UEFI bootkitUEFI bootkit
- GapzVBR bootkit
- RovnixVBR bootkit