# CVE-2026-16666: MCUboot swap resume trusts a flash-resident swap\_size, allowing pre-authentication out-of-bounds flash operations

- **Severity:** MEDIUM 5.7
- **CVSS:** 5.7 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: Low; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.20% (percentile 6, 2026-11-28)
- **CWE:** CWE-129
- **Published:** 2026-11-24T23:37:51.457Z
- **Modified:** 2026-11-25T20:18:46.843Z

## Who should check

- Anyone running mcu-tools mcuboot \>= 1.0.0, \<= \*

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

## Affected and fixed versions

- mcu-tools mcuboot: \>= 1.0.0, \<= \* (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-16666. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-16666.md
Affected: mcu-tools mcuboot >= 1.0.0, <= *
Fixed in: no fixed version listed yet

Steps:
1. Search this machine and project for mcu-tools mcuboot: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-16666 being exploited?

There is no confirmed exploitation: CVE-2026-16666 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.20% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-16666?

Medium: CVSS 5.7 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2026-16666?

mcu-tools mcuboot \>= 1.0.0, \<= \*.

### Is there a fix for CVE-2026-16666?

No fixed version is listed in the sources yet. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2026-16666?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/mcu-tools/mcuboot/security/advisories/GHSA-ggxc-7xvp-98v3>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-16666>
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-16666> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-16666>
