Skip to content

UEFI bootkit

BlackLotus UEFI Bootkit: Traces and Offline Checks

BlackLotus abuses CVE-2022-21894 to bypass Secure Boot and lives in the EFI system partition. Its ESP files, MOK, Measured Boot entries, checks and recovery.

Kind
UEFI bootkit · Boot layer
Platforms
Windows
First seen
2022-10
Status
In the wild
Checked by
EFI system partitionMeasured Boot logsWindows drivers

Overview

BlackLotus is a UEFI bootkit for Windows. ESET published the first public analysis on 1 March 2023 and called it the first UEFI bootkit seen in the wild that bypasses UEFI Secure Boot on fully updated Windows 11 systems. ESET reports that it had been advertised on underground forums for USD 5,000 since at least October 2022. ESET could not determine how it was distributed and found few samples. It notes that some installers stop if the system's locale is one of several in Moldova, Russia, Ukraine, Belarus, Armenia or Kazakhstan. No public report attributes it to a named group.

The Secure Boot bypass uses CVE-2022-21894 ("baton drop"), which Microsoft fixed in January 2022. Fixing the code did not stop the attack, because the old, vulnerable boot manager binaries were still validly signed and not yet revoked in the Secure Boot forbidden-signature database (DBX). Microsoft followed with CVE-2023-24932 in May 2023 and a staged set of revocations, described in KB5025885. In July 2023 part of the source code was published on GitHub, as reported at the time, which makes copies and variants more likely.

Installing BlackLotus needs administrator rights on the running system, or physical access. It is not a remote exploit.

How it loads and hides

ESET describes the chain in three stages, all through files on the EFI system partition (ESP):

  1. Installer, in Windows. It drops files to the ESP, renames the original Windows Boot Manager, switches off memory integrity (HVCI) and BitLocker protection, and reboots.
  2. Exploitation, once. On the next boot a vulnerable, Microsoft-signed boot manager reads an attacker BCD from a staging folder, ESP:\system32\, and the CVE-2022-21894 chain runs attacker code before Windows starts. That code enrolls the attacker's certificate as a shim Machine Owner Key (MOK) in the MokList UEFI variable, restores the victim's BCD and removes the staging files.
  3. Persistence, every boot. The Microsoft-signed shim now sits in place of bootmgfw.efi. Shim trusts the enrolled MOK, so it loads the self-signed bootkit grubx64.efi, which in turn loads the renamed original Windows Boot Manager.

Once Windows runs, the bootkit's kernel driver and an HTTP downloader injected into winlogon.exe take over. ESET reports that BlackLotus patches the entry points of Defender's early-boot drivers WdBoot.sys and WdFilter.sys, strips privileges from the Defender process, and creates the VbsPolicyDisable UEFI variable so that the loader does not start virtualization-based security. The kernel driver holds handles on winload.efi, bootmgfw.efi and grubx64.efi in the ESP so they cannot be changed or deleted, and crashes the system if those handles are closed. Microsoft notes that this protection is itself a sign: hashing one of those files on the live system fails with a sharing violation.

Because Secure Boot stays on and every binary that firmware checks is signed by Microsoft, a simple "Secure Boot is enabled" check passes on an infected host.

Traces on disk

LocationWhatSource
ESP:\EFI\Microsoft\Boot\grubx64.efiThe bootkit: a self-signed UEFI application. GRUB has no place in a Windows-only ESPESET, Microsoft
ESP:\EFI\Microsoft\Boot\bootmgfw.efiReplaced by the legitimate Microsoft-signed shim (named bootload.efi during installation)ESET
ESP:\EFI\Microsoft\Boot\winload.efiThe victim's original Windows Boot Manager, renamedESET
ESP:\EFI\Microsoft\Boot\BCD, BCDRDuring installation, the attacker BCD and a backup of the original; the original is restored afterwardsESET
ESP:\system32\Staging folder for the exploit (hvloader.efi, bootmgr.efi, mcupdate_GenuineIntel.dll, mcupdate_AuthenticAMD.dll, a second bcd). The files are deleted after installation; Microsoft reports that the folder remains and the deleted files may be recoverableESET, Microsoft
UEFI variables MokList, VbsPolicyDisableAttacker certificate; VBS switched off. In firmware NVRAM, not in a fileESET
HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity, value Enabled = 0Memory integrity turned off (only changed if the key already existed)Microsoft
C:\Windows\Logs\MeasuredBoot\*.logOne TCG log per boot. Boots after the infection show grubx64.efi and winload.efi as EV_EFI_BOOT_SERVICES_APPLICATION eventsMicrosoft
Microsoft-Windows-Windows Defender/Operational and System logDefender reporting that security intelligence stopped; System event 7023 for the Defender service ending with an errorMicrosoft

Microsoft also advises comparing the times of the ESP boot files with each other and with C:\Windows\Boot\EFI: recent or mismatched times on EFI\Microsoft\Boot files are worth a look. ESET's IOC list gives hashes and C&C domains; use them from ESET's report directly.

How to check a host

Offline, from a disk image or a collection:

  • Copy the whole ESP, not only EFI\Microsoft\Boot. A system32 folder at the ESP root, a grubx64.efi or winload.efi under EFI\Microsoft\Boot, or a bootmgfw.efi that is not signed by Microsoft Windows production certificates (the shim is signed by Microsoft's third-party UEFI CA instead) all match BlackLotus's layout.
  • Read the Measured Boot logs in C:\Windows\Logs\MeasuredBoot\. Compare the boot applications listed before and after a suspected date. See Reading Measured Boot logs.
  • Read the HVCI value above in the SYSTEM hive and the Defender and System logs around the same time.
  • Check deleted entries in the ESP's FAT directory for the staging files.

Live, from an elevated prompt:

mountvol S: /S
dir /a /s S:\
certutil -hashfile S:\EFI\Microsoft\Boot\grubx64.efi SHA256
powershell -c "Get-AuthenticodeSignature S:\EFI\Microsoft\Boot\bootmgfw.efi | Format-List"
powershell -c "Confirm-SecureBootUEFI"
reg query HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity /v Enabled
mountvol S: /D

A sharing-violation error from certutil on an ESP boot file is the locked-file sign Microsoft describes. Microsoft also reports outbound connections from winlogon.exe, notably on port 80, as a strong network sign. A live check runs under the bootkit's own kernel driver, so treat a clean result as weak; a copy of the ESP examined on another machine is better. The step-by-step collection is in How to check the EFI system partition offline.

What the checker looks for

  • esp reads every EFI binary and BCD store on the partition. On the layout ESET and Microsoft describe, it raises:

    • "A self-signed signature on \EFI\Microsoft\Boot\grubx64.efi" and "grubx64.efi does not belong in the Windows boot folder";
    • "The Windows Boot Manager is not signed by a Windows production CA" when bootmgfw.efi chains to Microsoft's third-party UEFI CA, as the shim does;
    • "winload.efi does not belong in the Windows boot folder". Windows keeps winload.efi in System32, so a boot application of that name in EFI\Microsoft\Boot\ is flagged even when Microsoft signed it, as the renamed boot manager is;
    • "BCDR does not belong in the Windows boot folder" for the backup of the original BCD;
    • "A system32 folder at the root of the EFI system partition" when a file is left in ESP:\system32\. A collection holds files, not empty folders, so a folder the installer emptied does not reach the checker: look for it, and for its deleted entries, in an image of the partition;
    • in a BCD that still carries the installer's settings: "The boot manager is told to load another BCD store", "The BCD enables test signing", "The BCD disables integrity checks" and "The BCD sets truncatememory" (or avoidlowmemory);
    • "is much newer than the other files in its folder" for an .efi file modified at least seven days after the median of its neighbours.

    Findings that match ESET's or Microsoft's description link to this page.

  • measuredboot reads the Windows TCG logs. For a boot after the infection it raises "\EFI\Microsoft\Boot\grubx64.efi was started from the Windows boot folder", and the same for winload.efi: the components Microsoft's guidance says the logs list. BlackLotus keeps Secure Boot on, so the Secure Boot findings stay quiet.

  • windrivers reads the SYSTEM hive and raises "Memory integrity (HVCI) is turned off in the registry" when HypervisorEnforcedCodeIntegrity\Enabled is 0. Users and vendors also turn it off, so on its own it is a lead, not a BlackLotus finding.

It cannot see the UEFI variables (MokList, VbsPolicyDisable), db or dbx in NVRAM, or the kernel driver and the injected downloader in memory. It checks signatures offline, without a trust store or revocation list, so the old Microsoft-signed boot managers the exploit relies on (CVE-2022-21894) pass as validly signed. It does not read the Defender logs or System event 7023; check those by hand. The sample's LAB-VM-02 host reproduces this layout with placeholder binaries, so its signature results differ from a real infection: see the sample walk-through.

Removal and recovery

Microsoft's advice for an infected device is to isolate it, then reformat both the operating system partition and the EFI system partition, or restore a clean backup that includes the ESP. In practice:

  1. Preserve first: image the disk, or at least copy the ESP and C:\Windows\Logs\MeasuredBoot\, and keep the BitLocker recovery key.
  2. Rebuild Windows from trusted media and rewrite the ESP. Cleaning the ESP files in place on the running system is not reliable while the driver protects them.
  3. Remove the attacker's MOK. It lives in firmware NVRAM and survives a disk wipe. ESET recommends deleting it with mokutil, which needs physical presence at the MOK Manager prompt during the next boot.
  4. Apply Microsoft's CVE-2023-24932 mitigations from KB5025885: the Windows UEFI CA 2023 certificate and a boot manager signed by it, then the DBX revocation of Windows Production PCA 2011, and optionally the Secure Version Number update. These changes cannot be undone once applied with Secure Boot on, and old recovery and installation media stop booting, so update media and back up BitLocker keys first.
  5. Turn memory integrity and BitLocker protection back on, update Defender, and rotate the credentials used on the host: the bootkit ran with full control of it.

The NSA guide warns that patching alone gives a false sense of security. It recommends monitoring the integrity of the boot partition, limiting administrator rights and, for advanced users, customising the Secure Boot databases.

Sources

Primary public reports, newest first.

  1. 2023-06-22BlackLotus Mitigation GuideNSA
  2. 2023-05-09How to manage the Windows Boot Manager revocations for Secure Boot changes associated with CVE-2023-24932 (KB5025885)Microsoft
  3. 2023-05-09CVE-2023-24932: Secure Boot Security Feature Bypass VulnerabilityMicrosoft
  4. 2023-04-11Guidance for investigating attacks using CVE-2022-21894: The BlackLotus campaignMicrosoft
  5. 2023-03-01BlackLotus UEFI bootkit: Myth confirmedESET
  6. 2022-01-11CVE-2022-21894: Secure Boot Security Feature Bypass VulnerabilityMicrosoft

See also