Securing the Boot Process
UEFI Vulnerabilities
UEFI firmware is a radical change over BIOS firmware. For comparison, the 1994 plug and play BIOS specification from Intel and Phoenix was 56 pages long and defined basic functionality to configure plug-and-play devices. The UEFI specification is 2558 pages and defines:
- A full TCP/IP network stack including WiFi, Bluetooth, UDP, IPsec, TLS, HTTP, DNS v4/v6, ARP, DHCP, and FTP support
- File I/O with support for USB devices
- A shell environment allowing scripting, and access to pre-boot applications that provide file manipulation and device access
All the features provided by UEFI facilitate management subsystems such as the
Intel Management Engine and AMD Secure Technology.
The Intel ME:
- Runs on an embedded microcontroller found in Intel chipsets integrated into motherboards
- Runs its own operating system with a micro-kernel
- Provides out-of-band access to system devices to include, RAM, and network interfaces
- Runs independent of the powerstate of the PC, even if the system is powered off
- CVE-2017-5689 for Intel Active Management Technology (AMT). This CVE is rated 10 in severity; it allows the complete compromise of integrity and confidentiality of a System while requiring no authentication, and very little skill to execute remotely. An exploit explanation is available here
- CVE-2018-3628 which revealed a possible buffer overflow in AMT's HTTP handler
- A number of CVEs were just disclosed allowing potential privilege escalation in machines running InsydeH2O firmware
- MoonBounce is a rootkit targeting UEFI firmware which was recently discoverd by Kapersky
Secure Boot
The UEFI Consortium created the secure boot specification to mitigate the chance of malicious code
being loaded and prevent the installation of rootkits
and bootkits.
Microsoft provides an overview of the UEFI Secure Boot process on
this page, and another more in-depth look at it
here. The UEFI Consortium also provides a description and some background information about secure boot
in this document. Finally, Brandon Adler gives a good description of the UEFI Secure Boot specification in this video:
Key Points are:
- The secure boot process creates a chain of trust utilizing public key certificates
- Secure boot uses RSA 2048 or stronger asymmetric encryption
- The secure boot Public Key Infrastructure (PKI) is very similar to PKI websites use; they have root certificate authorities (CA), and intermediate CAs, which sign their site's X.509 certificate
- The Platform Key (PK) is a self-signed key and acts as the root CA in the Secure Boot process
- The PK is usually set by the equipment manufacturer before shipping a system
- There can be only one PK in a UEFI secure boot system
- Key Exchange Keys (KEKs) are a second tier of keys
- KEKs establish a trust relationship between the OS and the firmware
- There can be several KEKs in the UEFI NVRAM
- Most systems have a Microsoft public CA key and a vendor public CA key pre-installed
- Both the PK and the KEKs can be used to update the secure boot databases
- The secure boot databases consist of the: Deny List Database (DBX), Allow List Database (DB), Timestamp Database (DBT), and Recovery Database (DB)
- The DBX is used to explicitly deny images which have a matching SHA-256 hash or revoked X.509 certificate
- The DBX is the first database that is checked before code is executed
- The DB stores signed signatures of allowed images such as operating system loaders like bootmgfw.efi
- The DBT stores timestamps to check if a certificate has expired
- The DBR stores authorized signatures for recovery images to use in the event that no valid DB image is found
- Secure boot is supported in Windows 8 and later versions
- Secure boot is a UEFI specification and does not require a Trusted Platform Module (TPM)
Additional Points:
- On boot, the UEFI firmware verifies the Boot Manager (bootmgfw.efi) signature in the secure boot DB
- Each Windows component in the boot chain verifies the Authenticode signature of the next component
- Starting with Windows 8, the Windows Kernel launches the Windows Defender Early Launch Anti-Malware (ELAM) driver (wdboot.sys)
- ELAM scans the signatures of third-party drivers to ensure they have valid digital signatures before loading them
While secure boot keys such as the PK are not intended to be installed by end-users, it is possible to create your own PK for secure boot and install it to your UEFI NVRAM. The NSA provides this instructional guide on how to completely customize UEFI secure boot with your own key Infrastructure.