Skip to content

Lesson 2 of 13 · 20m

UEFI and Secure Boot, Mechanically

Secure Boot is an Authenticode signature check on PE32+ binaries enforced by four NVRAM variables; its failure modes are revocation gaps, not broken crypto.

What the check actually is

Secure Boot is not a property of the firmware. It is a signature check that runs in the BDS/TSL phases of UEFI, applied to every image loaded through LoadImage — the OS loader, option ROMs, and boot applications. The image is a PE32+ executable. Its signature is Authenticode: a PKCS#7 SignedData blob stored in the PE's security directory (IMAGE_DIRECTORY_ENTRY_SECURITY), covering a hash of the file with the checksum field and the certificate table itself excluded. If the signer chains to a key in db, the image runs. If it matches dbx, or chains to nothing, it does not.

Four NVRAM variables drive the whole thing. PK is the Platform Key — a self-signed certificate naming the platform owner, enrolled by the OEM; possession of the private half is possession of Secure Boot. KEK holds Key Exchange Keys authorized to update the databases. db is the allow list — certificates and image hashes. dbx is the revocation list. On a normal PC, db contains the Microsoft UEFI CA and Windows production signers plus an OEM cert; dbx is Microsoft's revocation list, shipped through Windows Update and, on Linux, through fwupd/LVFS. One subtlety matters operationally: the firmware ships in 'setup mode' with no PK enrolled, and enforcement begins only when the PK is written — bootctl status or mokutil --sb-state distinguishes 'enabled' from 'set up'. A board reporting setup mode runs everything, signed or not — the two variables worth reading on a live system are SecureBoot and SetupMode under efivars, and only SecureBoot=1 with SetupMode=0 means enforcement is actually on.

The Linux chain adds two objects. shim is a ~1 MB PE signed by Microsoft's third-party CA; it embeds the distro's vendor certificate and adds the MOK (Machine Owner Key) list, managed with mokutil and enrolled at reboot through MokManager. Shim verifies GRUB against its embedded cert plus MOK; GRUB verifies the kernel via the shim lockdown protocol; the kernel then restricts itself in lockdown mode — unsigned modules refused, /dev/mem and kexec of unsigned kernels blocked.

The wrong mental model

"Secure Boot makes the boot trusted." It makes one loader signature-checked. It does not verify the DXE drivers inside firmware volumes — those are covered by signed capsules at update time or by Intel Boot Guard at boot time, a different mechanism fused in the chipset. It does not check file contents read as data — which is exactly the gap LogoFAIL exploited (Binarly, December 2023): DXE drivers parsed attacker-controlled BMP/PNG logo files straight off the ESP, and the parsers crashed into code execution during boot. Secure Boot watched it happen, because nothing in db was violated.

And revocation is the weak seam. BootHole (CVE-2020-10713) was a GRUB2 config parser overflow that ran before the kernel — the fix required revoking every signed GRUB and shim in existence, which is why the industry invented SBAT: a generation tag embedded in the PE's .sbat section, revoked wholesale via a signed sbat_level entry instead of thousands of dbx hashes. BlackLotus (ESET, March 2023 — the first real Secure-Boot-bypassing bootkit) rode CVE-2022-21894, "Baton Drop," using still-signed vulnerable Windows boot loaders; the vulnerable binaries stayed valid for months because revoking them broke deployed systems. The crypto never failed. The revocation did. That is the generalizable lesson: Secure Boot's real-world failures are logistics — how fast a revoked binary stops being trusted — rather than algorithm breaks.

What to actually do

Keep dbx current — fwupdmgr refresh && fwupdmgr update or Windows Update; a stale dbx is a standing invitation to every revoked-but-signed bootloader. Verify state with mokutil --sb-state or bootctl status. Never disable Secure Boot to load an unsigned module: sign it and enroll the key into MOK instead, or on systemd distros use sbctl to own the whole key hierarchy locally. Check efi-readvar -v pk — if the PK is a test key, you are one leaked private key away from an attacker-owned boot chain (that is PKfail, lesson of its own). Secure Boot is revocation hygiene, not a switch.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.