Skip to main content
Be Bitwise

Firmware & Hardware Supply Chain

Supply Chain & Binary Attacks · Advanced Exploitation track

9 min read

In this module

Below the Operating System

Software security usually means applications and operating systems. But beneath the OS sits another layer: firmware. Code stored in non-volatile memory on motherboards, network cards, drive controllers, GPUs, USB devices. Firmware runs before the OS loads, often with higher privilege than the OS kernel, and is typically invisible to security software.

An attacker who compromises firmware has a foothold that's extraordinarily difficult to detect or remove. The malware survives OS reinstallation, drive replacement, most forensic techniques. Firmware is the ultimate persistence mechanism — you can't wipe it with a factory reset.

UEFI: The Foundation of Boot Security

On modern x86 systems, the first code that executes when you press the power button is UEFI (Unified Extensible Firmware Interface), the successor to the traditional BIOS. UEFI is stored in a SPI flash chip on the motherboard and is responsible for:

  • Initialising the CPU, memory, and essential hardware
  • Detecting and configuring connected devices
  • Loading the operating system bootloader
  • Providing runtime services to the OS

UEFI is a complete software environment with its own drivers, applications, and file system access. It can read and write to disk, access the network, and execute arbitrary code - all before the operating system has loaded.

text
Power On
↓
UEFI firmware (SPI flash on motherboard)
↓
UEFI boot manager → selects bootloader
↓
OS bootloader (GRUB, Windows Boot Manager)
↓
OS kernel
↓
User-space applications
UEFI Firmware

UEFI (Unified Extensible Firmware Interface) is the firmware environment that initialises hardware and loads the operating system. It runs before the OS and has unrestricted hardware access. UEFI is stored in flash memory on the motherboard, making it a target for persistent malware that survives OS reinstallation.

UEFI Rootkits

A UEFI rootkit is malware that installs itself in the UEFI firmware. Because UEFI executes before the operating system, a UEFI rootkit can:

  • Modify the OS as it loads, injecting drivers or disabling security features
  • Intercept and alter disk reads, hiding its presence from the OS
  • Survive hard drive formatting and OS reinstallation (it lives on the motherboard's SPI flash, not on the disk)
  • Execute before any anti-malware software loads

Several UEFI rootkits have been discovered in the wild:

LoJax (2018): Discovered by ESET, LoJax was the first publicly documented UEFI rootkit used in a real attack (attributed to the Sednit/Fancy Bear group). It modified the UEFI firmware to drop a malicious agent into the Windows OS during boot. LoJax could persist across OS reinstallation and hard drive replacement.

MosaicRegressor (2020): Another UEFI rootkit discovered in the wild, which used modified UEFI firmware images to maintain persistence on targeted systems.

CosmicStrand (2022): Found in UEFI firmware images of certain Asus and Gigabyte motherboards, this rootkit modified the firmware to inject malicious code into the Windows kernel during the boot process.

MoonBounce (2022): Reported by Kaspersky, MoonBounce lived in the SPI flash itself, as a patch to the firmware's DXE core, and left no file on disk at all.

Secure Boot: The Defence

Secure Boot is a UEFI feature designed to prevent unauthorised code from running during the boot process. When Secure Boot is enabled:

  1. The UEFI firmware contains a database of trusted signing keys
  2. Every component loaded during boot (bootloader, drivers, OS kernel) must be signed by a trusted key
  3. If a component's signature is invalid or missing, the firmware refuses to execute it

This creates a chain of trust from the firmware to the operating system. A UEFI rootkit that modifies the bootloader or injects unsigned drivers would be blocked by Secure Boot - unless the attacker can bypass or disable Secure Boot itself.

Bypasses have included:

  • Vulnerabilities in the Secure Boot implementation itself that allow bypassing signature checks
  • Stolen or leaked signing keys
  • Boot-time vulnerabilities that execute before Secure Boot validation occurs
  • Physical access attacks that modify the SPI flash directly (since Secure Boot does not protect the firmware itself by default)

BlackLotus, documented by ESET in 2023, was the first bootkit seen in the wild that bypassed Secure Boot on fully patched Windows 11. It exploited CVE-2022-21894, a Windows boot manager flaw that was already patched, by bringing along old, validly signed but vulnerable boot manager binaries. Microsoft hadn't added them to the dbx revocation list, so the firmware accepted them. Late in 2023, Binarly's LogoFAIL research showed another route: image parsers in vendors' UEFI firmware that decode the boot logo had memory corruption bugs, and on many systems the logo could be replaced from the OS. Code ran in the firmware itself, before any Secure Boot check.

Intel Boot Guard goes further by anchoring trust in hardware. The CPU contains a hash of the expected firmware signing key, fused into the chip at manufacturing time. The CPU refuses to execute firmware that is not signed with the corresponding key. This protects against SPI flash modifications, but it also means only the OEM can update the firmware.

Put together, a Linux boot on a typical Intel machine looks like this. Solid arrows are signature checks that stop the next stage loading if they fail; the TPM boxes show measured boot, which doesn't block anything but records a hash of each stage so a remote verifier can spot a change later. Pick a stage and work out what an attacker would need to tamper with it: an SPI flash implant like LoJax has to get past Boot Guard, while a bootkit that swaps the bootloader has to get past the db and dbx checks.

BMC: The Computer Inside Your Computer

Server motherboards contain a BMC (Baseboard Management Controller) - an independent embedded computer with its own processor, memory, network interface, and operating system. The BMC provides "out-of-band" management: administrators can remotely access the server's console, power it on or off, mount virtual media, and monitor hardware health - even when the main server is powered off.

The BMC has access to:

  • The host system's memory (via the system bus)
  • The host system's network interface
  • The host system's storage (via virtual media)
  • The keyboard, video, and mouse (KVM over IP)

From a security perspective, the BMC is the most privileged component on the server. It can read and write the host's RAM, inject keystrokes, modify storage, and access the network - all independently of the host operating system and invisible to any software running on the host.

A compromised BMC gives an attacker:

  • Persistence: The BMC runs independently of the host. Reinstalling the OS, replacing the hard drive, or even replacing the CPU does not affect the BMC.
  • Stealth: The host OS cannot see what the BMC is doing. The BMC's network traffic goes through its own network interface (or a shared interface that the BMC manages).
  • Full control: The BMC can read any memory address, effectively giving the attacker the ability to extract encryption keys, credentials, and any data in host memory.

BMC firmware has historically been an embarrassment: default credentials, unpatched web servers, buffer overflows in management interfaces, insecure update mechanisms. Research has repeatedly demonstrated that BMC firmware on major server platforms can be compromised remotely. A classic example is IPMI 2.0's "cipher zero", a cipher suite with no authentication that many BMCs shipped enabled, so any password was accepted for a known user name; Dan Farmer's 2013 research drew wide attention to it. In late 2021 the Iranian firm Amnpardaz reported iLOBleed, an implant hidden in the firmware of HPE's iLO management controllers that also blocked firmware updates while pretending to apply them.

Hardware Implants

At the most extreme end of supply chain attacks are hardware implants - physical modifications to hardware during manufacturing, shipping, or maintenance.

A hardware implant could be:

  • A small chip added to a circuit board that provides a backdoor
  • A modified chip that includes additional, hidden functionality
  • A component that is replaced with a functionally identical but compromised version

Hardware implants are extremely difficult to detect because they can be smaller than a grain of rice, operate at the electrical level below any software visibility, and be designed to activate only under specific conditions.

Detection methods include:

  • X-ray inspection: Comparing the physical layout of a board against a known-good reference
  • Electrical testing: Measuring power consumption, signal timing, and electromagnetic emissions to detect unexpected components
  • Visual inspection: Using microscopy to examine individual components and solder joints
  • Side-channel analysis: Monitoring the device's behaviour for anomalous signals or timing

The Manufacturing Trust Problem

Modern electronics are manufactured through complex global supply chains involving dozens of companies across multiple countries. A single server motherboard contains components from many different manufacturers, assembled in factories that handle equipment from many different customers.

This creates a trust problem analogous to the software supply chain:

  • The chip designer might insert a backdoor in the design
  • The foundry (chip fabricator) might modify the design during manufacturing
  • The assembly facility might add, remove, or replace components
  • The distributor or shipper might tamper with the product in transit

Each step in the supply chain is a point where a compromise could occur. And unlike software, where you can at least theoretically inspect every line of source code, hardware verification at the transistor level requires expensive equipment and deep expertise.

Hardware Supply Chain

The hardware supply chain encompasses every step from chip design to final product delivery. Each step - design, fabrication, assembly, distribution - is a potential point for introducing compromises. Hardware attacks are harder to detect and remediate than software attacks because they require physical inspection and may be impossible to patch.

Defending the Supply Chain

Defence against firmware and hardware supply chain attacks requires a multi-layered approach:

  • Measured boot: Recording (measuring) the hash of every component loaded during boot into a hardware security module (TPM). The measurements can be verified remotely (remote attestation) to confirm that the system booted with expected firmware and software.
  • Firmware updates with signature verification: Only accepting firmware updates signed by the vendor's key, and verifying signatures before applying updates.
  • Supply chain transparency: Working with vendors who provide visibility into their manufacturing processes and support hardware verification.
  • Runtime firmware integrity monitoring: Periodically re-reading firmware from SPI flash and comparing it against a known-good copy.
  • Hardware security modules: Using TPMs, HSMs, and secure enclaves that provide a hardware root of trust independent of the main firmware.

The firmware and hardware supply chain is the deepest layer of trust in computing. Compromises here are rare but devastating, and defending against them requires a fundamentally different posture from conventional software security.