Out-of-bounds flash access via forged swap status in MCUboot
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- —
- Confidentiality · integrity · availability
- None · Low · High
- Fix status
- No fix listed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA.
Summary
MCUboot from 1.0.0 is affected, and no fixed version is listed. When resuming an interrupted image swap, the bootloader trusts a swap size read from flash without a bound check (CWE-129). An unauthenticated attacker using serial recovery can forge the swap status, causing out-of-bounds flash erase or copy operations or a hang before the primary image signature is checked. Exposure requires a swap-based update backend with serial recovery enabled.
Written with Claude Haiku 5.5 from the sources below · 2026-11-25
Description from the CNA
When MCUboot resumes an interrupted image swap it takes the number of bytes to move straight from the flash-resident status trailer. In boot_swap_image() (boot/bootutil/src/loader.c) the fresh-swap branch recomputes copy_size from the image headers and is bounded — swap_run() in boot/bootutil/src/swap_move.c carries an explicit "not enough free space" check (last_idx >= first_trailer_idx) — but that check runs only inside if (boot_status_is_reset(bs)). On the resume branch the code instead does boot_read_swap_size(fap, &bs->swap_size); copy_size = bs->swap_size; and passes the value to swap_run() with no re-derivation and no bound. swap_run() turns that byte count into a sector index by summing sector sizes until it reaches the count, with no ceiling on the real sector count: find_last_idx() in swap_move.c and swap_offset.c, and find_last_sector_idx() in swap_scratch.c, are all while (1) loops. The resulting index is fed to boot_img_sector_off() / boot_img_sector_size() (boot/bootutil/src/bootutil_priv.h), which index the fixed BOOT_MAX_IMG_SECTORS sectors[] arrays with no bounds check. Past num_sectors the loop reads zero-initialised — and past BOOT_MAX_IMG_SECTORS, adjacent-struct — entries; a sector size of 0 makes the loop never terminate, and a bogus computed offset is handed to boot_erase_region() / boot_copy_region() as an out-of-bounds flash erase or copy. MCUboot itself only ever writes a validated, slot-bounded swap_size (swap_misc.c, fixup_revert()), so reaching the defect requires writing the trailer from outside. Serial recovery provides exactly that: an upload writes attacker bytes contiguously from offset 0 of the primary slot (boot/boot_serial/src/boot_serial.c, via flash_area_id_from_multi_image_slot()), bounded only by img_size <= area_size, so it controls the whole trailer — magic, swap_info, op/idx/state and swap_size. The resume gate boot_status_is_reset() keys solely on those op/idx/state fields, and boot_find_status() explicitly trusts valid magic as implying valid metadata. A forged in-progress status with an oversized swap_size therefore drives the unbounded walk during swap setup — before the primary image's signature is validated, and serial recovery is unauthenticated by design. The outcome is an out-of-bounds flash erase or copy, or a non-terminating loop, inside the bootloader: an unbootable or bricked device, with the possibility of bootloader memory corruption. That exceeds what serial recovery is designed to grant, which is only the ability to stage an image that must still pass signature verification. Exposure requires a swap-based update backend — MCUBOOT_SWAP_USING_MOVE (the default for swap builds), MCUBOOT_SWAP_USING_SCRATCH or MCUBOOT_SWAP_USING_OFFSET; overwrite-only, direct-XIP and RAM-load builds are unaffected — together with MCUBOOT_SERIAL_RECOVERY. Without serial recovery the path is only reachable by an attacker who can already write flash directly, which is outside the threat model. The fix is to treat the trailer's swap_size as untrusted: reject or clamp it in boot_swap_image() before it becomes copy_size, bounding it by the primary slot's usable image area (sector count x sector size, excluding the trailer) rather than the raw flash_area_get_size(), and aborting recovery with a non-zero error on overflow. The same guard should cover the independent boot_read_swap_size() reads in each backend's boot_read_image_header().
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
Remediation
The sources list no fixed version for MCUboot.
Written with Claude Haiku 5.5 from the sources below · 2026-11-25
Timeline
- 2026-11-24 Threatist record created from CVE-2026-16666
- 2026-11-25 Alias added: GHSA-423v-c2rc-fj96
- 2026-11-25 CISA SSVC decision points changed
References
Other 1
More mcu-tools vulnerabilities
- TI-2026-97829 Out-of-bounds stack write in MCUboot encrypted serial recovery CVSS 3.1HIGH 8.4
- TI-2026-97830 MCUboot release builds compile out its assert() security checks CVSS 3.1HIGH 7.4
- TI-2024-21755 MCUboot Injection attack of unprotected TLV values CVSS 3.1HIGH 7.7
- TI-2026-97923 Out-of-bounds flash reads in MCUboot Cypress/PSoC6 backend CVSS 3.1MEDIUM 6.2
- TI-2026-91073 Out-of-bounds read in MCUboot serial recovery image index CVSS 3.1MEDIUM 5.1
- TI-2026-97925 Out-of-bounds read in MCUboot ECDSA signature parsing CVSS 3.1MEDIUM 4.0
Sources
- CVE-2026-16666 · CVE Program
- CVE-2026-16666 · NVD
- FIRST EPSS
- GHSA-423v-c2rc-fj96 · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences