Skip to main content

MCUboot CVE-2026-16666

| EUVDEUVD-2026-134822 MEDIUM
Improper Validation of Array Index (CWE-129)
2026-11-25 vulnerabilities@zephyrproject.org GHSA-423v-c2rc-fj96
5.7
CVSS 3.1 · Vendor: zephyrproject
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Access device serial-recovery interface
  2. Delivery
    Upload bytes forging in-progress status trailer
  3. Exploit
    Oversized swap_size bypasses reset-only space check
  4. Execution
    Unbounded sector walk during swap resume
  5. Impact
    Out-of-bounds flash erase/copy or infinite loop bricks device

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Array index validation
Exploitation Conditions

Exploitable only when the build uses a swap-based update backend - MCUBOOT_SWAP_USING_MOVE (default for swap builds), MCUBOOT_SWAP_USING_SCRATCH, or MCUBOOT_SWAP_USING_OFFSET - AND MCUBOOT_SERIAL_RECOVERY is enabled; overwrite-only, direct-XIP, and RAM-load builds are not affected. The attacker must have local access to the serial recovery transport, through which an unauthenticated upload (bounded only by img_size <= area_size) can overwrite the primary slot's status trailer from offset 0, forging a valid magic plus in-progress op/idx/state and an oversized swap_size so the resume gate boot_status_is_reset() selects the unbounded path before signature verification. Limiting factors: requires physical/console-level access to the serial recovery interface (AV:L), requires the specific swap+serial-recovery configuration, and without serial recovery the trailer is only writable by an attacker who already has direct flash write access, which is outside MCUboot's threat model. No fix is released yet; per the evidence, exposure is removed by disabling serial recovery or using a non-swap backend.

Impact

Signals point to a real but config-gated, locally-exploitable availability bug rather than a widespread emergency. The provided CVSS is 5.7 (MEDIUM) with vector AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H: the local attack vector is the dominant limiter because the only non-physical write primitive is MCUBOOT_SERIAL_RECOVERY, which needs console/serial access to the device. PR:N is accurate - serial recovery is unauthenticated by design and the defect triggers before the primary image's signature is checked. Exploitation status is 'no public exploit identified at time of analysis' (no CISA KEV entry and no PoC reference in the input). EPSS is not supplied, so probabilistic exploitation likelihood cannot be stated. The vuln.today decision label is 'this_month' (not act_now/emergency), consistent with a medium-severity, access-constrained issue. One internal conflict should be flagged: the input CVSS uses AC:H, but the description shows the attacker deterministically controls the entire forged status trailer (magic, op/idx/state, swap_size) via a bounded serial upload, so the brick/non-terminating-loop outcome is reliably reproducible and I assess attack complexity as low - verify AC with the vendor. Impact is primarily denial of service (unbootable/bricked device) with a stated possibility of bootloader memory corruption, so I:L/A:H is reasonable. Net: prioritize patching or mitigating on devices that both use a swap backend and expose serial recovery; for everything else (overwrite-only, direct-XIP, RAM-load, or no serial recovery) this is not reachable within the stated threat model. Urgency is raised by the absence of a released fix (PR #3013 is still open on main).

Exploit ScenarioDerived

An attacker with local access to a device's serial recovery interface uploads crafted bytes that paint the primary slot's status trailer with a forged 'in-progress' swap status carrying an oversized swap_size. On the next boot the bootloader takes the resume branch, trusts the attacker's swap_size without re-derivation or bounds, and walks sectors past the real count - erasing or copying flash out of bounds or spinning in a non-terminating loop, bricking the device before any signature check. No public PoC is identified; exploitation depends on the local, unauthenticated serial-recovery path (AV:L).

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
No patch listed yet 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 25, 2026

MCUboot's swap-resume path in boot_swap_image() trusts the flash-resident swap_size from the slot status trailer without re-derivation or bounds checking, so a forged oversized value drives an unbounded sector walk in find_last_idx()/find_last_sector_idx() that can erase or copy flash out of bounds or loop forever. Exploitation is configuration-gated: the build must use MCUBOOT_SWAP_USING_MOVE (the default for swap builds), MCUBOOT_SWAP_USING_SCRATCH, or MCUBOOT_SWAP_USING_OFFSET together with MCUBOOT_SERIAL_RECOVERY, whose upload path lets an unauthenticated local attacker paint the trailer before signature verification - overwrite-only, direct-XIP and RAM-load builds are unaffected. Outcomes are an unbootable or bricked device and possible bootloader memory corruption; no vendor fix is released yet, an upstream PR (#3013) is open, and no public exploit is identified in the supplied data.

RemediationAI

No vendor-released patch exists at the time of analysis; an upstream fix is in progress as open pull request https://github.com/mcu-tools/mcuboot/pull/3013 (advisory: https://github.com/mcu-tools/mcuboot/security/advisories/GHSA-ggxc-7xvp-98v3), which treats the trailer's swap_size as untrusted by rejecting or clamping it in boot_swap_image() against the primary slot's usable image area (sector count x sector size, excluding the trailer) rather than raw flash_area_get_size(), aborting recovery with a non-zero error on overflow and applying the same guard to each backend's boot_read_image_header() reads. Until that lands, exposure can be removed by disabling MCUBOOT_SERIAL_RECOVERY (which eliminates the only non-physical way to forge the trailer, at the cost of losing field recovery for bricked units) or by switching to a non-swap backend such as overwrite-only, direct-XIP or RAM-load (which removes the vulnerable swap/resume code path but changes the update strategy and rollback behaviour). Builds that must keep serial recovery and a swap backend should restrict physical/console access to the recovery transport, since the interface is unauthenticated by design and the attack requires local access to it; no other workaround is described in the available sources.

Affected VersionsENISA

mcuboot 1.0.0 ≤*

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

MCUboot is a secure bootloader for 32-bit MCUs; swap-based update backends (swap-move, swap-scratch, swap-offset) move image bytes between primary and secondary slots and persist progress in a status trailer stored in flash. boot_read_swap_size() reads that trailer's swap_size, which MCUboot itself only ever writes from a bounded, slot-derived copy_size (swap_misc.c, fixup_revert()). On the fresh-swap branch loader.c recomputes copy_size from the image headers, and swap_run()'s "not enough free space" check (last_idx >= first_trailer_idx) applies only inside if (boot_status_is_reset(bs)); the resume branch instead assigns copy_size = bs->swap_size verbatim and passes it to swap_run(). find_last_idx() (swap_move.c, swap_offset.c) and find_last_sector_idx() (swap_scratch.c) convert that byte count into an index via while(1) summation of sector sizes with no ceiling on the real sector count, and boot_img_sector_off()/boot_img_sector_size() index fixed BOOT_MAX_IMG_SECTORS sectors[] arrays with no bounds check. Past num_sectors the walk consumes zero-initialised entries and past BOOT_MAX_IMG_SECTORS adjacent-struct memory; a zero sector size makes the loop non-terminating, and the bogus offset is handed to boot_erase_region()/boot_copy_region(). The root cause class is CWE-129 (improper validation of array index); serial recovery supplies the write primitive because its upload writes attacker-controlled bytes contiguously from offset 0 of the primary slot, bounded only by img_size <= area_size, and boot_find_status() treats valid magic as implying valid metadata. The trigger requires a forged, in-progress status trailer with an oversized swap_size; the evidence describes the resume gate as keying solely on the op/idx/state fields read from that same trailer.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (zephyrproject) PRIMARY 5.7 MEDIUM
AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H
vuln.today AI 6.8 MEDIUM

AV:L because the only write primitive is local serial recovery; PR:N/UI:N as it is unauthenticated pre-signature; AC:L because the attacker deterministically controls the forged trailer; A:H brick, I:L possible memory corruption, C:N.

3.1 AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
4.0 AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (zephyrproject).

CVSS VectorVendor: zephyrproject

Attack Vector
Local
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
High

DescriptionCVE.org

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

Threat Intelligence Overview

EPSS Score
0.1%
Top 98% exploitable
Prevalence
Medium
de facto embedded/IoT secure bootloader, but exposure is swap-plus-serial-recovery config-gated
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available No
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Related Vulnerabilities in MCUboot Flash and Crypto Security Flaws

View all 4

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy