CWE-1274 covers a secure boot process that copies bootloader code from non-volatile memory into volatile memory without enough protection on the volatile side. SoC and firmware engineers are the audience.
How it happens
During secure boot, the SoC's ROM code fetches bootloader code from non-volatile memory (NVM), usually external to the chip, and stores it in volatile memory (VM) such as DRAM or SRAM, usually internal. As the code is transferred, the ROM code authenticates it.
Authentication happens at the copy. After that, the code sits in VM. If an adversary or an untrusted agent can modify that region, they can replace the authenticated code with their own, and the secure boot is bypassed.
The recorded example is CVE-2019-2267, where locked memory regions could be modified through other interfaces in a secure-boot-loader image because of improper access control.
What an attacker gains
Rated high: modifying memory, executing unauthorized code or commands, and gaining privileges or assuming identity, with access control and integrity lost. Code running at boot level controls everything above it.
How to find it
MITRE gives two manual analyses.
- Check that the volatile memory is lockable, and that it is locked against writes from untrusted agents. Try modifying it from an untrusted agent and confirm the writes are dropped.
- Identify all fabric master agents active during the boot flow when initial code moves from non-volatile storage to volatile memory, and identify the memory regions that hold the loaded executable code. Then check what each agent can do to those regions.
How to fix it
- Lock the volatile memory region holding boot code once it is loaded and authenticated.
- Allow writes only from the trusted loading path.
- Check that every other interface to that region respects the lock, as the CVE shows other interfaces can bypass it.
- Keep the test that attempts untrusted writes in your regression suite.
Quick check
Why is authentication at copy time not enough?
The code can be changed after it is authenticated if the memory it sits in is not protected.