Repository navigation
Bootloaders mcuboot
Secure bootloader for 32-bit microcontrollers.
| Type | Monolithic bootloader (type3) |
| Upstream | https://github.com/mcu-tools/mcuboot |
| CVEs attributed | 3 |
| Vulnerability-fixing commits | 9 naming a CVE, 10 keyword-matched |
| CVEs with a linked fix | 0 |
Validates image signatures, manages primary/secondary slots, handles rollback and swap, then jumps to the application.
Type 3: it runs from reset on the MCU and jumps straight into the application -- there is no OS-loader stage to hand off to.
The SoK paper gives a full case study of this bootloader in section 3.6. See Boot-Stages for the eight-stage model these phases map onto.
- reset vector -- The MCU resets into MCUboot, which occupies the first region of flash.
- bootutil -- The core library: reads the image headers and TLV trailers, validates signatures and hashes, and implements the swap logic.
- slot selection -- Decides between the primary and secondary slot based on the image trailer's flags -- a pending update, a test image awaiting confirmation, or a revert.
- swap or overwrite -- If an update is pending, the slots are swapped through the scratch area, or the secondary simply overwrites the primary.
- boot application -- Board- and RTOS-specific code sets the vector table and stack pointer and jumps to the primary slot's entry point.
MCUboot's stage communication is flash layout. The image trailer at the end of each slot holds the magic value, the image-OK and copy-done flags and the swap status -- written in a defined order so an interrupted swap can be resumed rather than bricking the device. That trailer is the only channel between the running application and the bootloader: the application confirms a new image by writing image-OK, and a reset without that confirmation causes a revert. There are no system tables and no runtime services; everything else is fixed at build time.
The jump to the application is deliberately minimal -- vector table relocated, stack pointer set, branch to the reset handler -- and nothing is passed. The application can read boot metadata back through boot_serial or the shared data region if the platform enables it, which is also how measured-boot data reaches a TF-M secure image.
| CWE | CVEs |
|---|---|
| CWE-354 | 1 |
| CWE-121 | 1 |
| CWE-347 | 1 |
Detected in its build configuration and source:
- cfi
- encryption
- measured boot
- rollback protection
- secure boot
- signature verification
See Security-Mechanisms for how these are detected and what a detection does and does not prove.
git -C oss-bootloaders submodule update --init type3/mcuboot
./scripts/analysis/run-tool.sh codeql mcubootSee Tools for what each tool applies to.