Analyzing UEFI Bootkit Persistence

Analyzes UEFI bootkit persistence mechanisms including firmware implants in SPI flash, EFI System Partition

What Is This

The "Analyzing UEFI Bootkit Persistence" skill is designed to help security professionals and incident responders identify, analyze, and understand persistence mechanisms employed by UEFI bootkits. UEFI (Unified Extensible Firmware Interface) bootkits are advanced malware families that embed themselves in system firmware or manipulate boot chain components for stealthy, highly persistent access. This skill focuses on detection and forensic analysis of such threats, including firmware implants in SPI flash memory, modifications to the EFI System Partition (ESP), Secure Boot bypass techniques, and UEFI variable manipulation.

The skill provides practical guidance and technical methods for investigating known UEFI bootkit families such as BlackLotus, LoJax, MosaicRegressor, MoonBounce, and CosmicStrand. It also covers leveraging tools like CHIPSEC for firmware integrity verification, auditing Secure Boot configurations, and performing forensic inspection of the ESP partition on compromised systems.

Why Use It

UEFI bootkits represent one of the most persistent and difficult-to-detect forms of malware. Since they operate at the firmware level, below the operating system, they can survive OS reinstallation, disk replacement, and standard malware removal techniques. Attackers use these advanced threats to maintain long-term, covert access to target systems, often as part of sophisticated APT campaigns. Detection and remediation require specialized knowledge and tooling.

Use of this skill enables:

  • Detection of malicious firmware modifications that can re-infect systems after remediation
  • Identification of Secure Boot tampering or bypass that could allow unsigned or malicious bootloaders
  • Analysis of malicious changes to the ESP that can redirect the boot process or load rootkits early in the boot chain
  • Forensic investigation and attribution of advanced threats that leverage UEFI persistence

How to Use It

1. Firmware Integrity Verification with

CHIPSEC

CHIPSEC is an open-source framework for analyzing the security of PC platforms, including firmware integrity. To check for unauthorized modifications in UEFI firmware:

pip install chipsec
sudo chipsec_util spi dump firmware_dump.bin
sudo chipsec_util uefi decode firmware_dump.bin
sudo chipsec_main -m tools.uefi.find_vuln

Compare the extracted firmware image (firmware_dump.bin) against a known-good baseline from the system vendor. Any differences should be closely examined for signs of unauthorized modules or code.

2. Inspecting the EFI System

Partition (ESP)

The ESP typically contains the bootloaders and EFI applications. Malicious actors often modify or add files to this partition to gain persistence.

  • On Windows:
    mountvol S: /S
    dir S:\EFI /S
  • On Linux:
    sudo mount /dev/sdX1 /mnt/esp
    ls -lR /mnt/esp/EFI

Look for suspicious or recently modified EFI binaries (.efi), unknown directories, or unexpected changes in boot order.

3. Auditing Secure Boot

Configuration

Attackers may disable Secure Boot or enroll rogue Machine Owner Keys (MOKs) to permit unsigned bootloaders.

  • On Windows, use PowerShell:
    Confirm-SecureBootUEFI
  • On Linux:
    mokutil --sb-state
    mokutil --list-enrolled

Check that Secure Boot is enabled and only trusted keys are enrolled.

4. UEFI Variable

Analysis

UEFI variables control aspects of the boot process. Attackers may manipulate these to affect boot order or bypass security controls.

  • On Linux:
    efivar -l
    efivar -d <GUID> -n <VariableName>

Review for unexpected variables or values, especially those related to boot entries or Secure Boot.

5. Detection of Known Bootkit

Families

The skill enables identification of artifacts and behaviors associated with prominent UEFI bootkits. For example:

  • LoJax: Presence of malicious DXE drivers in firmware, unauthorized write access to SPI flash
  • BlackLotus: Secure Boot bypass, malicious bootloader in ESP
  • MoonBounce: In-memory persistence, malicious SMM drivers
  • CosmicStrand: Firmware images with embedded malicious code in boot services

Refer to threat intelligence sources for specific indicators of compromise (IOCs).

When to Use It

Apply this skill when:

  • A system re-establishes Command and Control (C2) connections after OS or disk replacement, suggesting persistence below the OS
  • Secure Boot has been disabled, tampered with, or new, unauthorized MOKs are found
  • Firmware integrity checks fail when compared to vendor baselines
  • Memory forensics reveal rootkit components loaded during early boot
  • Investigating APT campaigns or systems suspected of firmware-level compromise

Important Notes

  • UEFI and firmware analysis is a highly specialized field. Always ensure you have proper backups and vendor support before performing firmware operations.
  • Extracting and analyzing firmware images may void warranties or violate support agreements.
  • Use trusted, offline systems for firmware analysis to avoid further compromise.
  • Not all suspicious firmware modifications are malicious. Some vendors update firmware silently, so always compare against vendor-provided images.
  • Handling UEFI malware may require device re-flashing or hardware replacement if a compromise is confirmed.
  • The skill is most effective when combined with endpoint detection, threat intelligence, and incident response workflows.

By leveraging this skill, analysts can detect and remediate some of the most sophisticated and persistent threats facing modern computing platforms.