T1542.001

System Firmware

Adversaries may modify system firmware (BIOS or UEFI/EFI) to achieve persistent access that survives OS reinstallation and disk replacement. Because firmware executes before the operating system loads, malicious implants planted here are extremely difficult to detect and remove. Attackers typically require a vulnerable or attacker-supplied kernel-mode driver to gain ring-0 access to SPI flash memory before overwriting or patching the firmware image. Real-world examples include LoJax (Fancy Bear/APT28), which repurposed the legitimate LoJack anti-theft agent's UEFI module; Trojan.Mebromi, which modified the Award BIOS; and the Hacking Team UEFI Rootkit. Detection must focus on observable pre-conditions and side-effects: execution of firmware analysis and flashing utilities, loading of privileged hardware-access drivers, suspicious UEFI variable modification, and creation of raw firmware image files.

Microsoft Sentinel / Defender
kusto
let FirmwareToolNames = dynamic([
    "chipsec_main.py", "chipsec.exe", "flashrom.exe", "RwDrv.exe",
    "RWEverything.exe", "AFUWIN.exe", "AFUWIN64.exe", "fpt.exe",
    "fptw.exe", "fptw64.exe", "FWUpdate.exe", "biosflash.exe",
    "meinfo.exe", "meinfowin.exe", "AmiBIOSCoreUtil.exe",
    "bios.exe", "efi_extract.exe", "UEFITool.exe", "iflash.exe"
]);
let SuspiciousDriverNames = dynamic([
    "RwDrv.sys", "sednit.sys", "chipsec.sys", "WinIo.sys",
    "WinIo64.sys", "PhyMemX64.sys", "DirectIO64.sys",
    "asmmap64.sys", "gdrv.sys", "bsflash64.sys", "inpoutx64.sys",
    "hwrwdrv.sys", "lenovoemc.sys", "atkwio.sys"
]);
let FirmwareCLIPatterns = dynamic([
    "chipsec", "flashrom", "-spi", "--spi", "SpiFlash",
    "bios.rom", "firmware.rom", "uefi.rom", "bios.bin",
    "uefi.bin", "bios_backup", "flash_bios", "WriteToSMBios",
    "RWEverything", "WinPmem", "/writephysmem", "/readphysmem"
]);
// Branch 1: Execution of known firmware analysis or flashing tools
let FirmwareToolExecution = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (FirmwareToolNames)
    or ProcessCommandLine has_any (FirmwareCLIPatterns)
| extend AlertReason = "FirmwareTool_Execution",
         RiskDetail = strcat("Process: ", FileName, " | CMD: ", ProcessCommandLine);
// Branch 2: Loading of privileged hardware-access drivers (pre-requisite for SPI flash write)
let SuspiciousDriverLoad = DeviceImageLoadEvents
| where Timestamp > ago(24h)
| where FileName has_any (SuspiciousDriverNames)
    or FolderPath has_any ("\\Temp\\", "\\Downloads\\", "\\AppData\\")
       and FileName endswith ".sys"
       and not(InitiatingProcessFileName in~ ("MsMpEng.exe", "svchost.exe", "services.exe"))
| extend AlertReason = "HardwareAccess_Driver_Load",
         RiskDetail = strcat("Driver: ", FileName, " | Path: ", FolderPath, " | Loaded by: ", InitiatingProcessFileName);
// Branch 3: Service installation of unsigned/suspicious kernel driver (Event 7045 equivalent via MDE)
let SuspiciousServiceInstall = DeviceEvents
| where Timestamp > ago(24h)
| where ActionType == "ServiceInstalled"
| where AdditionalFields has ".sys"
| extend ServiceName = tostring(parse_json(AdditionalFields).ServiceName),
         ServiceImagePath = tostring(parse_json(AdditionalFields).ServiceImagePath)
| where ServiceImagePath has_any ("\\Temp\\", "\\Users\\", "\\ProgramData\\")
    or ServiceName has_any ("RwDrv", "chipsec", "WinIo", "DirectIO", "PhyMem", "asmmap")
| extend AlertReason = "SuspiciousKernelDriver_Installed",
         RiskDetail = strcat("Service: ", ServiceName, " | Path: ", ServiceImagePath);
// Branch 4: Creation of raw firmware image files
let FirmwareImageCreated = DeviceFileEvents
| where Timestamp > ago(24h)
| where FileName endswith ".rom" or FileName endswith ".fd" or FileName endswith ".cap"
    or (FileName endswith ".bin" and FolderPath !has "\\Windows\\"
        and FolderPath !has "\\Program Files\\"
        and not(InitiatingProcessFileName in~ ("svchost.exe", "MsMpEng.exe")))
| extend AlertReason = "FirmwareImage_FileCreated",
         RiskDetail = strcat("File: ", FileName, " | Path: ", FolderPath, " | Created by: ", InitiatingProcessFileName);
union FirmwareToolExecution, SuspiciousDriverLoad, SuspiciousServiceInstall, FirmwareImageCreated
| project Timestamp, DeviceName, AccountName, AlertReason, RiskDetail,
         FileName, InitiatingProcessFileName, InitiatingProcessCommandLine, SHA256
| sort by Timestamp desc
critical severity medium confidence

Data Sources

Process: Process Creation Driver: Driver Load File: File Creation Windows Event Log: System (Service Install) Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents DeviceImageLoadEvents DeviceFileEvents DeviceEvents

False Positives

  • Legitimate BIOS updates applied by OEM vendor software (HP System Software Manager, Dell Command Update, Lenovo System Update) — these write .cap or .fd files and load vendor-signed flash drivers
  • Security researchers or IT administrators running chipsec or RWEverything for firmware integrity auditing — typically executed from identified IT asset accounts on designated systems
  • Hardware diagnostics tools bundled with workstation imaging suites that load low-level I/O drivers during provisioning
  • Firmware update components within enterprise software management agents (SCCM, BigFix) that temporarily install driver packages
  • Virtualization platforms and hypervisors loading signed hardware-access drivers for device passthrough or UEFI emulation

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections