CVE-2026-16664
Received Received - Intake

Buffer Overflow in MCUboot Zephyr Serial Recovery

Vulnerability report for CVE-2026-16664, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-11-13

Last updated on: 2026-11-13

Assigner: Zephyr Project

Description

MCUboot's Zephyr serial-recovery upload handler bs_upload() in boot/boot_serial/src/boot_serial.c decodes the host-supplied image field of an MCUmgr image-upload request into img_num (a full 32-bit value) and latches it on the off == 0 packet without any range check. It then passes img_num straight to flash_area_id_from_multi_image_slot(img_num, 0), which on the Zephyr port resolves to __flash_area_ids_for_slot() in boot/zephyr/include/sysflash/sysflash.h and indexes the static const int all_slots[] table as all_slots[img_num 2]. That table holds only MCUBOOT_IMAGE_NUMBER 2 entries, so any img_num >= MCUBOOT_IMAGE_NUMBER is an out-of-bounds read. The path is reachable by anyone with access to the serial / SMP recovery console, which is unauthenticated by design, and the bad value is supplied before any image signature is verified. The defect is specific to the default non-direct upload path (MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD disabled) on the Zephyr port with the array-backed slot layout (not CONFIG_SINGLE_APPLICATION_SLOT). It is not gated on a multi-image configuration: MCUBOOT_IMAGE_NUMBER defaults to 1, so even a default single-image build is affected for any image >= 1. The MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD path is safe (its flash_area_id_from_direct_image() switch returns -EINVAL for unknown indices). flash_area_id_from_multi_image_slot() takes a signed int image_index while img_num is uint32_t, so the attacker controls the sign of the index as well as its magnitude: an image of 0xFFFFFFFF converts to -1 and reads all_slots[-2], off the front of the table, while large positive values read off the end (CWE-192). Either way the index multiply img * 2 is performed in int, so a wild offset yields a bus/hard fault, giving a reliable denial of service of the bootloader during recovery. For moderately out-of-range indices the read returns adjacent .rodata as a garbage flash-area id that is handed to flash_area_open(); this normally fails with MGMT_ERR_EINVAL, but if the garbage id happens to match a valid non-image partition, the subsequent erase/write can target a partition outside the image set (CWE-787). The attacker-supplied value is never echoed back, so there is no information disclosure. The fix is to reject img_num >= BOOT_IMAGE_NUMBER on the off == 0 packet, before the slot lookup. The comparison must be made on the unsigned img_num: an equivalent guard applied after the conversion to int would not reject the negative case above. __flash_area_ids_for_slot() should bounds-check its own arguments as defence in depth. This vulnerability was reported independently twice: by NVIDIA Project Vanessa on 2026-06-22, and by Kai Phan (@kaimandalic) on 2026-07-19 as GHSA-8v33-88p6-jffj, which is closed as a duplicate of this advisory. Both original reports are reproduced in full below.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-11-13
Last Modified
2026-11-13
Generated
2026-11-13
AI Q&A
2026-11-13
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
mcu-tools mcuboot From 2.0.0 (inc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-129 The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability is an out-of-bounds read in MCUboot's Zephyr serial-recovery upload handler. It occurs when an attacker supplies a malicious image index value that is not checked against the valid range before being used to access a static table. The table only holds a fixed number of entries, so out-of-range values cause the system to read invalid memory locations, leading to crashes or unintended behavior.

Detection Guidance

Detecting this vulnerability requires checking if your MCUboot Zephyr port uses the vulnerable serial-recovery upload handler. Inspect the boot_serial.c file for the bs_upload() function and verify if image ID validation is missing. Check if MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD is disabled and CONFIG_SINGLE_APPLICATION_SLOT is not set. Commands to check include: grep -r 'bs_upload' in boot/boot_serial/src/, and checking Zephyr configuration files for MCUBOOT_IMAGE_NUMBER and relevant Kconfig options.

Impact Analysis

An attacker with access to the unauthenticated serial recovery console could exploit this to crash the bootloader, causing a denial of service. In some cases, it might also allow writing to unintended flash partitions if the out-of-bounds value matches a valid partition ID. The attack happens before image signature verification, so no authentication is required.

Compliance Impact

This vulnerability primarily impacts integrity and availability controls. An attacker could cause denial of service by crashing the bootloader during recovery, violating availability requirements in standards like HIPAA. If the out-of-bounds value matches a valid partition ID, unintended writes to other flash regions could occur, potentially compromising data integrity or confidentiality, which may violate GDPR or HIPAA depending on the data stored.

Mitigation Strategies

Apply the patch from commit 183a05f256bdbbac86edcb048958da59018f814e which adds validation for the image ID in bs_upload(). Ensure img_num is checked against BOOT_IMAGE_NUMBER before slot lookup. Disable the serial recovery console if not needed. Monitor for unusual bootloader crashes or flash write attempts during recovery mode.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-16664. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart

Security Radar

News mentioning this vulnerability
Loading related security news...