T1542.003

Bootkit

Adversaries may use bootkits to persist on systems by modifying boot sectors or EFI System Partition (ESP) files, enabling malicious code to execute before the operating system loads. On BIOS systems, adversaries overwrite the Master Boot Record (MBR) or Volume Boot Record (VBR) to hijack the boot sequence. On UEFI systems, they create or modify files in the ESP (e.g., bootmgfw.efi, shimx64.efi) to run malicious kernel code. Notable real-world examples include WhisperGate (MBR overwrite with fake ransom note), BOOTRASH (VBR persistence), TrickBot's TrickBoot module (UEFI firmware implant), ROCKBOOT (MBR bootkit deployed by APT41), and BlackLotus (UEFI bootkit bypassing Secure Boot). Bootkits survive OS reinstallation and are extremely difficult to remediate without specialized tooling and hardware replacement in severe cases. Detection depends on identifying raw disk write operations, suspicious process access to physical drive paths, unauthorized ESP file modifications, and use of known firmware/boot manipulation utilities.

Microsoft Sentinel / Defender
kusto
let BootkitToolNames = dynamic(["dd.exe", "rawwrite.exe", "rawdisk.exe", "bootice.exe", "mbrfix.exe", "bcdedit.exe", "bootsect.exe", "diskpart.exe", "mbr2gpt.exe"]);
let RawDiskPaths = dynamic(["\\\\.\\PhysicalDrive", "\\Device\\Harddisk", "\\\\.\\PHYSICALDRIVE", "\\\\?\\PhysicalDrive"]);
let EFIFilePatterns = dynamic(["bootmgfw.efi", "bootmgr.efi", "grubx64.efi", "shimx64.efi", "mmx64.efi", "MokManager.efi", "bootx64.efi"]);
let LegitBootUpdaters = dynamic(["TrustedInstaller.exe", "TiWorker.exe", "wuauclt.exe", "svchost.exe", "MicrosoftEdgeUpdate.exe", "MsMpEng.exe", "SenseIR.exe"]);
// Arm 1: Raw disk write access via MDE telemetry
let RawDiskWrites = DeviceEvents
| where Timestamp > ago(24h)
| where ActionType == "RawDiskWriteAccess"
| where not(InitiatingProcessFileName has_any (LegitBootUpdaters))
| extend DetectionSource = "RawDiskWriteAccess"
| project Timestamp, DeviceName, AccountName, ActionType, DetectionSource,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         InitiatingProcessParentFileName, InitiatingProcessAccountName;
// Arm 2: Process creation accessing physical drive paths or using boot manipulation tools
let BootManipulationProcesses = DeviceProcessEvents
| where Timestamp > ago(24h)
| where (ProcessCommandLine has_any (RawDiskPaths)
    or FileName in~ (BootkitToolNames))
| where not(InitiatingProcessFileName has_any (LegitBootUpdaters))
| where not(FileName =~ "diskpart.exe" and ProcessCommandLine has_any ("list disk", "list volume", "list partition", "select disk", "select volume"))
| extend DetectionSource = "BootManipulationProcess"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionSource;
// Arm 3: EFI System Partition file creation or modification by non-OS processes
let ESPModifications = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified", "FileRenamed")
| where (FolderPath has_any ("\\EFI\\", "\\Boot\\", "EFI System") or FileName has_any (EFIFilePatterns))
| where FileName endswith ".efi" or FileName in~ (EFIFilePatterns)
| where not(InitiatingProcessFileName has_any (LegitBootUpdaters))
| extend DetectionSource = "ESPModification"
| project Timestamp, DeviceName, AccountName, ActionType, FolderPath, FileName,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionSource;
union RawDiskWrites, BootManipulationProcesses, ESPModifications
| sort by Timestamp desc
critical severity medium confidence

Data Sources

Drive: Drive Modification Drive: Drive Access Process: Process Creation File: File Creation File: File Modification Microsoft Defender for Endpoint

Required Tables

DeviceEvents DeviceProcessEvents DeviceFileEvents

False Positives

  • Windows Update and OS upgrade processes (TrustedInstaller.exe, TiWorker.exe) legitimately modify EFI boot files during feature updates and cumulative updates
  • Third-party disk partitioning and management tools (Acronis, Macrium Reflect, AOMEI Partition Assistant) perform raw disk access during backup and cloning operations
  • Dual-boot setup utilities (grub-install, bootice.exe used legitimately) writing bootloader files to ESP during Linux installation alongside Windows
  • IT provisioning and imaging tools (MDT, WDS, Clonezilla, Ghost) that write raw disk images during OS deployment
  • Disk diagnostic and manufacturer firmware update utilities (Dell Command Update, HP BIOS Update, Lenovo Vantage) that access raw drive sectors or update EFI files

Unlock Pro Content

Get the full detection package for T1542.003 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections