CVE-2026-16663: Pre-authentication out-of-bounds write in MCUboot encrypted serial recovery image decryption

Published Nov 24, 2026
·
Updated

MCUboot's encrypted serial-recovery path contains an attacker-controlled out-of-bounds stack write in decryptregioninplace() in boot/bootserial/src/bootserialencryption.c. The routine decrypts an uploaded encrypted image one flash sector at a time into a sector-sized stack VLA buf[sz], but when the current sector is still inside the image header it sets the destination index to the absolute header size (idx = hdr->ihhdrsize; at boot/bootserial/src/bootserialencryption.c:156) and then decrypts into &buf[idx]. The correct sibling routine boot/bootutil/src/loader.c:876 uses the sector-relative idx = hdr->ihhdrsize - absoff; the serial path is missing the - absoff term, so for any sector after the first the index runs past the end of the stack buffer.

The ihhdrsize field is a uint16t taken verbatim from the uploaded image header. On the second sector onward, when ihhdrsize exceeds the sector size, &buf[idx] points beyond buf and bootencdecrypt() writes attacker-controlled plaintext into adjacent stack frames. The path is reached pre-authentication: bsupload() calls boothandleencfw() (boot/bootserial/src/bootserial.c:1208) after upload, and the pre-decryption signature gate in decryptimageinplace() is compiled out (#if 0 at boot/bootserial/src/bootserialencryption.c:226-233), so the header is never validated before decryption.

A second error in the same window computation affects the first sector. When a sector holds both the end of the header and the start of the TLV area, the decrypt length is clamped to tlvoff - (off + bytescopied), measured from the start of the sector rather than from idx (boot/bootserial/src/bootserialencryption.c:166). An encrypted image whose header and payload end within the first sector is therefore decrypted for ihhdrsize bytes more than it should be: into the TLV area and, when the image ends near the end of the sector, past buf. This form needs no oversized header, so even an ordinary small encrypted image can trigger it, and it reaches devices with sectors of up to about 128 KiB rather than only those whose sector is smaller than the 16-bit ihhdrsize.

Reaching the sink requires a build with MCUBOOTENCIMAGES and serial recovery enabled, and access to the device's serial/USB recovery interface (unauthenticated by design). With the public-key encryption schemes the AES content key is wrapped to the device's public encryption key, so an attacker can author a fully crafted encrypted image — including a malicious ihhdrsize — without the image-signing private key. The result is a controllable stack memory-corruption inside the bootloader before any signature check, providing a path to code execution in the secure-boot root of trust that bypasses image authentication, as well as a denial-of-service. A 2048-byte out-of-bounds write was reproduced under AddressSanitizer (sz=4096, off=4096, ihhdrsize=6144).

On releases before v2.0.0 (v1.9.0 and v1.10.0) the destination is a file-scope static uint8t buf[SOCFLASHERASEBLKSZ] in .bss rather than the stack VLA described above — the code then lived in boot/zephyr/singleloader.c, before commit c9fa6088 relocated it to boot/bootserial/src/bootserialencryption.c and changed the buffer's storage class. The out-of-bounds write is equally real and equally pre-authentication on those releases, but it corrupts adjacent static data rather than the stack, so a stack-smashing proof of concept written against a current release will not reproduce as-is there.

Affected Software

1 affected component
MCUboot MCUboot

Event History

Nov 24, 2026
CVE Published
via MITRE·09:39 PM
Data Sourced
via MITRE·09:39 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:18 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed?

Devices that enable MCUboot's encrypted serial-recovery upload path are exposed. The vulnerable processing occurs after an encrypted image upload and before authentication.

2

What access and image properties are required to trigger the issue?

An attacker needs local access to the serial-recovery interface and does not need privileges or user interaction. The uploaded encrypted image must reach a sector after the first while its ih_hdr_size value exceeds the flash-sector size.

3

What is written out of bounds?

The decryption routine writes attacker-controlled plaintext beyond its sector-sized stack buffer. The write can reach adjacent stack frames.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203