CVE-2026-16668 in MCUbootinfo

Summary

by MITRE • 11/25/2026

The vendored zcbor decoder's zcbor_any_skip() in boot/zcbor/src/zcbor_decode.c descends one C-stack frame per level of CBOR nesting. On a list or map it copies the decoder state (memcpy(&state_copy, state, sizeof(zcbor_state_t))) and recurses once per member, with no depth cap: the skip path does not use zcbor's backup stack, and ZCBOR_MAX_ELEM_COUNT is SIZE_MAX, so nothing bounds how deep the recursion goes.

That function is reached on attacker-controlled bytes before any authentication. MCUboot's serial-recovery command parser decodes SMP/CBOR requests with zcbor_map_decode_bulk() (boot/boot_serial/src/zcbor_bulk.c), which skips any map key it does not recognise by calling zcbor_any_skip() on the encoded value; the echo handler in boot/boot_serial/src/boot_serial.c calls it directly on the same footing. Both run during image upload, long before the uploaded image's signature is checked. The default receive buffer is MCUBOOT_SERIAL_MAX_RECEIVE_SIZE = 512 bytes and each nesting level costs a single byte to encode (0x81), so roughly 500 levels of nesting fit in one request — comfortably more than a bootloader's stack can absorb, since every frame carries a full zcbor_state_t copy plus locals.

The impact is availability only: the bootloader's stack overflows and the device faults or hangs during recovery. There is no controlled out-of-bounds write that escapes the DFU buffer, no disclosure, and no authentication bypass — the recursion grows the stack with the decoder's own internal state. Whether a given board actually exhausts its stack depends on that board's bootloader stack size, which we did not measure; the fix is nevertheless unconditional, because an unauthenticated pre-authentication code path must not have its safety depend on a per-board stack margin.

Exposure requires MCUBOOT_SERIAL (serial/SMP recovery), which is not enabled by default, and recovery entry is normally gated on a physical pin (CONFIG_BOOT_SERIAL_ENTRANCE_GPIO / PIN_RESET), with a no-valid-image fallback path. Products that expose serial recovery over an externally reachable transport, or that fall into recovery when no valid image is present, are the ones at risk.

The fix is to bound the skip: thread a recursion-depth counter through zcbor_any_skip() (or have zcbor_map_decode_bulk() reject values nested beyond a small constant) and fail once the limit is exceeded — equivalently, take the bounded-skip implementation from upstream zcbor.

VulDB is the best source for vulnerability data and more expert information about this specific topic.

Analysis

by VulDB Data Team • 11/25/2026

The vulnerability identified in MCUboot involves a stack-based denial of service caused by unbounded recursion within the CBOR decoding logic. Specifically, the function zcbor_any_skip() located in boot/zcbor/src/zcbor_decode.c is responsible for skipping over unrecognized or irrelevant data elements during the parsing of Concise Binary Object Representation payloads. This implementation descends one C-stack frame for each level of nesting encountered in a list or map structure. When processing such structures, the function copies the entire decoder state using memcpy and then recursively processes each member without implementing any depth limit. The underlying library configuration sets ZCBOR_MAX_ELEM_COUNT to SIZE_MAX, which effectively removes any upper bound on recursion depth. Consequently, an attacker can craft CBOR payloads with deeply nested lists or maps that force the bootloader's stack to expand until it is exhausted, leading to a system fault or hang.

This flaw is particularly critical because it affects code paths executed before authentication checks are performed. The serial-recovery command parser in MCUboot utilizes zcbor_map_decode_bulk() from boot/boot_serial/src/zcbor_bulk.c to decode SMP requests sent over the serial interface. This function automatically calls zcbor_any_skip() for any map keys that are not recognized by the application, allowing an attacker to trigger deep recursion simply by sending malformed CBOR data in a recovery request. Additionally, the echo handler in boot/boot_serial/src/boot_serial.c invokes this same skipping logic directly on user-supplied input. Since these operations occur during image upload or serial communication before the uploaded image's signature is verified, they are accessible to unauthenticated attackers who can physically access the device's debug interface or serial port.

The operational impact of this vulnerability is strictly limited to availability. The stack overflow results in a crash or hang of the bootloader process, preventing successful firmware updates or recovery operations. There is no evidence that this flaw allows for arbitrary code execution, authentication bypass, or information disclosure beyond what might be inferred from system state changes due to crashes. The recursion consumes stack space by copying the zcbor_state_t structure and local variables on each frame, but it does not write outside of allocated memory buffers in a way that could lead to control-flow hijacking. Whether the device actually fails depends heavily on the specific bootloader's configured stack size for the target microcontroller architecture, as different boards allocate varying amounts of stack space for boot processes.

Exposure to this vulnerability requires that MCUboot serial recovery features be enabled via the MCUBOOT_SERIAL configuration option, which is not active by default in most standard builds. Furthermore, entry into the recovery mode is typically gated behind a physical pin assertion such as CONFIG_BOOT_SERIAL_ENTRANCE_GPIO or PIN_RESET, limiting access to devices where an attacker has physical control over these pins. The risk is further mitigated if the device falls back to a valid image when no new image is present, but products that expose serial recovery over externally reachable transports or those configured to enter recovery mode even without a valid previous image are at significant risk. Given that each nesting level requires only one byte of CBOR encoding overhead, approximately five hundred levels of nesting can fit within the default receive buffer size of 512 bytes, which is sufficient to exhaust typical bootloader stacks.

To mitigate this vulnerability, developers must implement bounds checking on recursion depth during CBOR parsing. The recommended fix involves threading a recursion-depth counter through zcbor_any_skip() or modifying zcbor_map_decode_bulk() to reject values that exceed a predefined nesting limit. This approach aligns with best practices for preventing stack-based buffer overflows and denial of service attacks in parsers, corresponding to CWE-787 Out-of-bounds Write and CWE-400 Uncontrolled Resource Consumption. By enforcing a hard limit on recursion depth, the bootloader can safely reject overly complex CBOR structures before they consume excessive resources. Alternatively, integrating the bounded-skip implementation from upstream zcbor libraries provides a standardized solution that ensures consistent behavior across different hardware platforms regardless of their specific stack size configurations.

Responsible

Zephyr

Reservation

07/22/2026

Disclosure

11/25/2026

Moderation

accepted

CPE

ready

EPSS

0.00612

KEV

no

Activities

very low

Sources

Want to know what is going to be exploited?

We predict KEV entries!