Skip to main content
Menu
CVEs

MCUboot out-of-bounds flash erase and copy in swap resume

CVE-2026-16666Published November 24, 2026, updated

5.7MediumCNA
Exploited
No known exploitation
Fix
See vendor advisory
Who is exposed
Not reported

Summary

MCUboot can be made to erase or copy flash outside its intended bounds, or to hang, when it resumes an interrupted image swap. An attacker with local access can trigger this without logging in and without any user action, by writing a crafted swap status record to the primary slot through serial recovery.

Written by a model

Original description

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().

What to do

Check your systems with an agent

Paste this into a coding or ops agent. It checks your systems read-only and reports a table per asset.

Check whether my systems are affected by CVE-2026-16666 (MCUboot swap resume trusts a flash-resident swap_size, allowing pre-authentication out-of-bounds flash operations), using the cve.now data below.

Rules: work read-only. Do not run exploit code, proof-of-concept scripts or scanners that send attack payloads, and do not change any configuration, package, image or deployment. Report findings only.

What cve.now has for CVE-2026-16666 (entry last updated 2026-11-24):
Affected:
- mcu-tools mcuboot: from 1.0.0
Fixed versions: none listed yet.
Setup: unknown whether the bug needs a non-default feature or setting. Check the advisory.
CISA KEV: CVE-2026-16666 is not listed as of cve.now's last read.
This KEV status is for CVE-2026-16666 only. If you also check another CVE, look up its own KEV status; never assume it from this one.

How to check:
- Installed software: check what is actually running, not what a repo declares. Read the version from each host, container image and Kubernetes node (the binary's version output, the OS package database, image layers), and check whether the conditions above hold there. Distribution packages may carry a backported fix under an older version number; confirm against the distribution's own advisory.

Verify against the linked advisories before concluding, and cite the date you read each one:
- https://github.com/mcu-tools/mcuboot/security/advisories/GHSA-ggxc-7xvp-98v3
Do not conclude an asset is unaffected unless you checked it and the evidence covers both its version and the conditions above. If you could not check something, mark it unknown and say what is missing.

Report a table with one row per asset and these columns: Asset | Version or build | Status (affected, fixed, not applicable, unknown) | Compensating controls | Exposure (internet-facing, internal, none) | Evidence | Next action.

Entry: https://cve.now/CVE-2026-16666
For follow-up questions, use the cve.now MCP server at https://mcp.cve.now/mcp (no authentication), for example execute with name cve.get and arguments {"id": "CVE-2026-16666"}.

Affected versions

cve.now Index

11Pof 100 · provisional · methodology v3
  • Exploitation?/40Unknown. No CISA SSVC exploitation rating yet
  • Exposure?/25Unknown. No advisory context yet
  • Reach?/20Unknown. No tracked technology or package matched
  • Severity5.7/10CVSS 5.7
  • No patch5/5No fixed version listed; see vendor advisory

What would change the score

  • Would score about 66 if added to CISA KEV
  • Would score about 61 if CISA's SSVC rates exploitation active
  • Would score about 33 if advisories confirm default setups are exposed

Timeline

  1. CVE published
  2. First seen by cve.now

Evidence 2

KindSource
Vendor advisory 1Establishes: Affected and fixed versions.
AdvisoryGitHub · mcu-tools/mcuboot · Advisory GHSA-ggxc-7xvp-98v3
CVE record 1Establishes: The identifier and description.
RecordCVE List · CVE-2026-16666

Questions about CVE-2026-16666

Is CVE-2026-16666 being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.

Source: cve.now feed data

Which versions are affected by CVE-2026-16666?

mcuboot: from 1.0.0.

Source: cve.now feed data

No corrections so far. Something wrong on this page? Report an error.