Skip to content

UEFI bootkit

Bootkitty Linux UEFI Bootkit: Traces and Offline Checks

Bootkitty, a proof-of-concept UEFI bootkit for Ubuntu, replaces GRUB in the EFI system partition and loads unsigned kernel modules. Traces, checks, recovery.

Kind
UEFI bootkit · Boot layer
Platforms
Linux
First seen
2024-11
Status
Proof of concept
Checked by
EFI system partitionMeasured Boot logsLinux kernel

Overview

Bootkitty is a UEFI bootkit for Linux. ESET published it on 27 November 2024, after a sample named bootkit.efi was uploaded to VirusTotal that month, and described it as the first UEFI bootkit aimed at Linux. ESET judged it a proof of concept: it found no deployment in its telemetry, the code only works on a few Ubuntu versions, and it relies on hard-coded byte patterns and offsets that can crash a system instead of compromising it. ESET, in an update on 2 December 2024, and Binarly later reported that it had been written as a project in Korea's Best of the Best (BoB) security training programme. The "BlackCat" strings in its kernel module have, according to ESET, no link to the ALPHV/BlackCat ransomware group.

On 29 November 2024, Binarly reported that a file found alongside the samples, logofail.bmp, exploits LogoFAIL, CVE-2023-40238, an image-parsing flaw in the BMP decoder of Insyde-based firmware. The exploit writes the bootkit's certificate into the shim MokList variable, so that shim trusts the bootkit with Secure Boot on. Binarly names affected models from Acer, HP, Fujitsu and Lenovo, and notes that Insyde's fix only helps once the vendor's firmware update is installed.

Bootkitty is on this list because it shows what a Linux bootkit looks like on disk and in the kernel, and because LogoFAIL remains unpatched on many machines.

How it loads and hides

Bootkitty is meant to sit on the EFI system partition (ESP) in place of Ubuntu's GRUB. ESET's removal advice implies the layout: the bootkit as /EFI/ubuntu/grubx64.efi, the legitimate GRUB moved to /EFI/ubuntu/grubx64-real.efi. Ubuntu's shim loads grubx64.efi as usual.

The bootkit is signed with a self-signed certificate, so it runs only when Secure Boot is off or when its certificate has been added to the shim's Machine Owner Key list, which is what the LogoFAIL file does. ESET describes what it does next, in memory:

  • with Secure Boot on, it hooks the firmware's image authentication protocols so that every check reports success;
  • it loads the real GRUB and patches its signature checks, so GRUB loads the kernel without verifying it;
  • it patches the decompressed kernel: the module signature check always passes, the version and banner strings become BoB13, and init is started with LD_PRELOAD=/opt/injector.so /init.

After boot, ESET found related components: BCDropper, an unsigned kernel module (dropper.ko) whose modinfo output and debug paths contain "BlackCat"; it removes itself from the kernel's module list, hides files whose names start with injector, and drops an ELF that ESET named BCObserver to /opt/observer. BCObserver waits for gdm3 to start, then loads /opt/rootkit_loader.ko. ESET did not recover /opt/injector.so or rootkit_loader.ko.

Traces on disk

LocationWhatSource
/boot/efi/EFI/ubuntu/grubx64.efiThe bootkit, self-signed, where GRUB should beESET
/boot/efi/EFI/ubuntu/grubx64-real.efiThe legitimate GRUB, renamedESET
UEFI variable MokListA rogue certificate written by the LogoFAIL exploit (firmware NVRAM, not a file)Binarly
logofail.bmpThe LogoFAIL image found with the samples; the reports do not say where it would sit on a targetBinarly
/opt/injector.soPreloaded into init through LD_PRELOADESET
/opt/observerBCObserverESET
/opt/rootkit_loader.koKernel module loaded by BCObserverESET
dropper.koBCDropper, unsigned, "BlackCat" in modinfoESET
Kernel log, /proc/sys/kernel/taintedA tainted kernel after boot; BoB13 in the kernel bannerESET

ESET's report gives these SHA-1 hashes:

FileSHA-1
bootkit.efi35ADF3AED60440DA7B80F3C452047079E54364C1
dropper.koBDDF2A7B3152942D3A829E63C03C7427F038B86D
observerE8AF4ED17F293665136E17612D856FA62F96702D

Copies built from the same project would have different hashes; the layout above is the more durable trace.

How to check a host

Offline, from an image or a collection with boot/efi/:

  • List EFI/ubuntu/ on the ESP. A grubx64-real.efi is not part of Ubuntu's layout. Compare grubx64.efi with the signed copy shipped by the grub-efi-amd64-signed package, /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed, and check its signer: Ubuntu's GRUB is signed by Canonical, the bootkit is self-signed.
  • Look in /opt for injector.so, observer and rootkit_loader.ko, and for .ko files outside /lib/modules.
  • Read kern.log or the saved journal for taint messages and a kernel banner containing BoB13.
  • If a TPM event log was saved, read it: shim extends MokList into PCR 14 and measures each binary it loads into PCR 4 (shim README.tpm), so an added certificate or a different second-stage loader changes the log between boots.

Live:

mokutil --sb-state
mokutil --list-enrolled
sudo ls -la /boot/efi/EFI/ubuntu/
sudo sha256sum /boot/efi/EFI/ubuntu/grubx64.efi /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
sudo sbverify --list /boot/efi/EFI/ubuntu/grubx64.efi
uname -v
cat /proc/sys/kernel/tainted
sudo cat /proc/1/environ | tr '\0' '\n' | grep LD_PRELOAD
ls -la /opt

ESET lists BoB13 in uname -v or dmesg, LD_PRELOAD in the environment of PID 1, and an unexpected taint value as signs. It also notes that on a Secure Boot system, an unsigned test module that loads successfully means module signature checking has been switched off. A rootkit that hides files and modules can make ls and lsmod lie; read the ESP and root file system from another system to be sure. The Linux side is covered in Checking Linux kernel modules offline and on Linux Forensics' kernel modules page.

What the checker looks for

  • esp reads boot/efi/EFI/... on a Linux host. Bootkitty's grubx64.efi raises "A self-signed signature on \EFI\ubuntu\grubx64.efi" when its signing certificate is itself self-signed; outside the Windows and fallback folders this is a medium finding. The renamed grubx64-real.efi keeps GRUB's valid distribution signature, so the checker lists it without a finding: compare the folder with the package copies, as shown above. "is much newer than the other files in its folder" applies when the folder holds at least three files and the bootkit is a week or more newer than the rest.
  • measuredboot reads a saved binary_bios_measurements, which covers only the boot it was saved in; the checker compares boots only for Windows logs. It raises "Secure Boot was off during this boot" when the firmware measured Secure Boot as off, which Bootkitty needs unless the attacker's certificate is enrolled. If the firmware measured the renamed GRUB when the bootkit started it, \EFI\ubuntu\grubx64-real.efi appears as "A boot application outside the usual boot paths". The detail sheet lists the db entries that authorized each image; the checker does not read the MOK list measurements.
  • linuxkernel reads module files only under lib/modules/, so dropper.ko and /opt/rootkit_loader.ko are not read as modules, and nothing searches modinfo for "BlackCat". It can show their load in the kernel log ("Kernel log: unsigned module loaded", "Kernel log: out-of-tree module loaded") when the kernel printed those lines and kern.log or messages was collected, and, with the collect script's _live/ outputs, "Kernel tainted by an out-of-tree or unsigned module".

It cannot read UEFI variables, so a rogue MokList entry is only visible with mokutil on the live host or by decoding its measurement in the TPM log yourself. It cannot test whether the firmware is vulnerable to LogoFAIL; that is the firmware vendor's advisory and update.

Removal and recovery

ESET's fix for the bootkit itself is to move /EFI/ubuntu/grubx64-real.efi back to /EFI/ubuntu/grubx64.efi, which works only if the bootkit was deployed under that name. On a real incident, prefer:

  1. Preserve the ESP, the root file system and the kernel logs.
  2. Reinstall GRUB and shim from the distribution's signed packages, or rebuild the host. The kernel ran with signature checks off and with unknown modules; files and modules may be hidden.
  3. Remove unknown MOK certificates (mokutil --delete with the certificate file, or mokutil --reset), then confirm at the MokManager prompt on the next boot.
  4. Install the firmware vendor's update for LogoFAIL, turn Secure Boot on, and set a firmware password.
  5. Rotate credentials used on the host, as for any root-level compromise.

Sources

Primary public reports, newest first.

  1. 2024-11-29LogoFAIL Exploited to Deploy Bootkitty, the first UEFI bootkit for LinuxBinarly
  2. 2024-11-27Bootkitty: Analyzing the first UEFI bootkit for LinuxESET
  3. 2024-11-27Bootkitty indicators of compromiseESET
  4. 2023-12-07CVE-2023-40238 (LogoFAIL in Insyde BmpDecoderDxe)NVD

See also