A Comprehensive Memory Safety Analysis of Bootloaders

Jianqiang Wang, Meng Wang, Qinying Wang, Nils Langius, Li Shi, Ali Abbasi, Thorsten Holz2025 · DOI

TL;DR

Researchers have conducted the first systematic memory safety analysis of bootloaders, the critical "bridge" between hardware firmware and the operating system. By developing a novel fuzzing framework that simulates a bare-metal environment, they uncovered 39 vulnerabilities (38 previously unknown) across nine major bootloaders, including 14 in the widely used Linux standard, GRUB.

What Problem Does This Paper Address?

The bootloader is a high-stakes component in the "chain of trust." Its job is to initialize the system and verify the OS image before handing over control. If a bootloader is compromised, an attacker can bypass Secure Boot, gain full system control, or cause a permanent "brick."

Despite this importance, modern bootloaders like GRUB have become bloated, supporting dozens of file systems, network protocols (HTTP/TFTP), and even custom fonts and background images. This massive codebase creates a huge attack surface. Furthermore, testing bootloaders is notoriously difficult because they run in a "bare-metal" environment—without the luxury of an underlying operating system to provide memory protection, standard libraries, or easy debugging hooks.

Methods

The authors tackled the "bare-metal" testing challenge by building a specialized fuzzing framework. Key components include:

  • Attack Surface Survey: They analyzed 85 historical CVEs to identify three primary attack vectors: Storage (file system parsers), Network (protocol stacks), and Console (command-line shells).
  • Hypervisor-Based Fuzzing: They used kAFL, a tool that leverages Intel Processor Trace (PT) to track code coverage without needing to modify the bootloader's binary.
  • Virtual Machine Simulation: To create a realistic environment, they ran the bootloaders inside a VM, allowing them to intercept peripheral access (like disk reads or network packets) and inject fuzzed data.
  • Custom Bare-Metal Sanitizers: Since standard tools like AddressSanitizer (ASAN) don't work without an OS, the team implemented a custom heap sanitizer and paging mechanisms to detect memory corruption and "panic" hooks to catch crashes.
  • Targeted Harnesses: They wrote specific code "harnesses" for each bootloader to trigger complex operations, such as mounting a file system or processing a network packet, ensuring the fuzzer reached deep into the logic.

Datasets

The study evaluated nine prominent open-source bootloaders, chosen for their active maintenance and widespread use:

  1. GRUB: The Linux standard.
  2. Das U-Boot: Common in embedded systems.
  3. barebox: Another embedded favorite.
  4. Limine, CloverBootloader, Easyboot, rEFInd, systemd-boot, and shim.

The researchers also compiled a dataset of 85 historical CVEs to categorize root causes of past failures.

Key Insights and Ideas

  • Peripherals are the Primary Threat: 48% of historical vulnerabilities were linked to storage (file systems/parsers) and 28% to network stacks. Attackers don't need to break the crypto; they just need to feed a malformed NTFS image or a crafted DHCP packet.
  • Static Analysis is Insufficient: The researchers compared their fuzzer against industry-standard static analysis tools (CodeQL and Clang Static Analyzer). The static tools produced hundreds of reports but only a handful of true positives, often missing the complex, inter-procedural logic bugs that the fuzzer caught easily.
  • The "Feature Creep" Penalty: Bootloaders that try to do too much (like GRUB) inevitably harbor more bugs. Simpler bootloaders like systemd-boot and shim showed significantly fewer vulnerabilities in this analysis.

Key Results

  • Vulnerability Discovery: Found 39 vulnerabilities, 38 of which were "zero-days" (previously unknown).
  • Impact on GRUB: 14 vulnerabilities were found in GRUB alone. Some of these are critical enough to potentially allow a Secure Boot bypass.
  • Developer Response: At the time of publication, 29 vulnerabilities had already been confirmed or patched by developers, and 5 new CVEs were assigned.
  • Efficiency: The framework successfully reproduced 7 known historical CVEs within hours, proving its effectiveness compared to manual auditing.

Limitations and Future Work

  • Hardware Specificity: The current framework focuses on high-level logic (file systems, protocols). It does not yet fuzz low-level hardware drivers, which are often written in assembly and are highly specific to individual chips.
  • Architecture Lock-in: Because the fuzzer relies on Intel-specific hardware features (Intel PT), it is currently limited to x86 architectures, though many bootloaders also run on ARM.
  • Manual Effort: While the fuzzing is automated, creating the initial "harness" for a new bootloader still requires significant manual reverse-engineering of the bootloader's internal API.

The authors have open-sourced their framework prototype on GitHub to encourage the security community to continue hardening these foundational pieces of software.

Summary updated

Abstract

The bootloader plays an important role during the boot process, as it connects two crucial components: the firmware and the operating system.After powering on, the bootloader takes control from the firmware, prepares the early boot environment, and then hands control over to the operating system.Modern computers often use a feature called secure boot to prevent malicious software from loading at startup.As a key part of the secure boot chain, the bootloader is responsible for verifying the operating system, loading its image into memory, and launching it.Therefore, the bootloader must be designed and implemented in a secure manner.However, bootloaders have increasingly provided more features and functionalities for end users.As the code base grows, bootloaders inevitably expose more attack surfaces.In recent years, vulnerabilities, particularly memory safety violations, have been discovered in various bootloaders.Some of these vulnerabilities can lead to denial of service or even bypass secure boot protections.Despite the bootloader's critical role in the secure boot chain, a comprehensive memory safety analysis of bootloaders has yet to be conducted.In this paper, we present the first comprehensive and systematic memory safety analysis of bootloaders, based on a survey of previous bootloader vulnerabilities.We examine the potential attack surfaces of various bootloaders and how these surfaces lead to vulnerabilities.We observe that malicious input from peripherals such as storage devices and networks is a primary method attackers use to exploit bootloader vulnerabilities.To assist bootloader developers in detecting vulnerabilities at scale, we designed and implemented a bootloader fuzzing framework based on our analysis.In our experiments, we discovered 39 vulnerabilities in nine bootloaders, of which 38 are new vulnerabilities.In particular, 14 vulnerabilities were found in the widely used Linux standard bootloader GRUB, some of which can even lead to secure boot bypass if properly exploited.So far, five CVEs have been assigned to our findings. To detect bootloader vulnerabilities on a larger scale, we developed and implemented a bootloader fuzzing framework.Using this framework, we analyzed nine bootloaders and found 38 novel vulnerabilities, 29 of which were confirmed or patched by the developers.To foster research in this area, we open-source our framework prototype at https://github.com/wjqsec/bootloader.
BibTeX
@misc{wang2025comprehensive,
  author = {Jianqiang Wang and Meng Wang and Qinying Wang and Nils Langius and Li Shi and Ali Abbasi and Thorsten Holz},
  title = {{A Comprehensive Memory Safety Analysis of Bootloaders}},
  year = {2025},
  doi = {10.14722/ndss.2025.240330},
}
Figure