Read the docs

Out-of-bounds stack write in MCUboot encrypted serial recovery

Priority LOW 37CWE-787Published · Updated

Key facts

Attack vector
Local
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA. Impact type from CWE-787 and the CVSS impact.

Summary

MCUboot, the secure bootloader project from mcu-tools, has an out-of-bounds stack write in the encrypted serial recovery path in decrypt_region_inplace(). A header index that is not made relative to the current sector lets decrypted data be written past the end of a sector-sized stack buffer. An unauthenticated attacker with access to the serial or USB recovery interface can send a crafted encrypted image, before any signature check, to corrupt bootloader stack memory. The issue is rated CVSS 8.4 with local access, and it can lead to code execution or denial of service.

Written with Claude Haiku 5.5 from the sources below · 2026-11-30

Description from the CNA

MCUboot's encrypted serial-recovery path contains an attacker-controlled out-of-bounds stack write in decrypt_region_inplace() in boot/boot_serial/src/boot_serial_encryption.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->ih_hdr_size; at boot/boot_serial/src/boot_serial_encryption.c:156) and then decrypts into &buf[idx]. The correct sibling routine boot/bootutil/src/loader.c:876 uses the sector-relative idx = hdr->ih_hdr_size - abs_off; the serial path is missing the - abs_off term, so for any sector after the first the index runs past the end of the stack buffer. The ih_hdr_size field is a uint16_t taken verbatim from the uploaded image header. On the second sector onward, when ih_hdr_size exceeds the sector size, &buf[idx] points beyond buf and boot_enc_decrypt() writes attacker-controlled plaintext into adjacent stack frames. The path is reached pre-authentication: bs_upload() calls boot_handle_enc_fw() (boot/boot_serial/src/boot_serial.c:1208) after upload, and the pre-decryption signature gate in decrypt_image_inplace() is compiled out (#if 0 at boot/boot_serial/src/boot_serial_encryption.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 tlv_off - (off + bytes_copied), measured from the start of the sector rather than from idx (boot/boot_serial/src/boot_serial_encryption.c:166). An encrypted image whose header and payload end within the first sector is therefore decrypted for ih_hdr_size 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 ih_hdr_size. Reaching the sink requires a build with MCUBOOT_ENC_IMAGES 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 ih_hdr_size — 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, ih_hdr_size=6144). On releases before v2.0.0 (v1.9.0 and v1.10.0) the destination is a file-scope static uint8_t buf[SOC_FLASH_ERASE_BLK_SZ] in .bss rather than the stack VLA described above — the code then lived in boot/zephyr/single_loader.c, before commit c9fa6088 relocated it to boot/boot_serial/src/boot_serial_encryption.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.

Why it matters now

EPSS 0.00401 25th percentileScored 2026-11-30
Fix Fixed mcuboot (mcu-tools): 2.5.1

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
mcu-toolsmcuboot1.9.0 to before 2.5.12.5.1Patch availableCNA
  • mcuboot Vendormcu-tools Affected 1.9.0 to before 2.5.1 Fixed in 2.5.1 Patch available CNA

Remediation

Upgrade mcu-tools mcuboot from 1.9.0 before 2.5.1 to 2.5.1, which fixes the issue. The sources list no fixed version for mcu-tools mcuboot releases before 1.9.0.

Written with Claude Haiku 5.5 from the sources below · 2026-11-30

  • Fix · CNA mcuboot (mcu-tools) Fixed in 2.5.1

Fixed in the same release

Records fixed by the same vendor advisory or release, as the CNA lists them.

  • Release ·

    mcu-tools mcuboot 2.5.1

    2 records Highest priority Priority LOW 2 LOW

    Other records, highest priority first

    • TI-2026-97875 Unbounded CBOR recursion in MCUboot serial recovery allows pre-authentication stack exhaustionPriority LOW 13

Timeline

  1. 2026-11-24 Threatist record created from CVE-2026-16663
  2. 2026-11-25 Alias added: GHSA-r62q-q5vc-23h5

References

  • TI-2026-97830 MCUboot release builds compile out its assert() security checks CVSS 3.1HIGH 7.4
  • TI-2024-21755 MCUboot Injection attack of unprotected TLV values CVSS 3.1HIGH 7.7
  • TI-2026-97923 Out-of-bounds flash reads in MCUboot Cypress/PSoC6 backend CVSS 3.1MEDIUM 6.2
  • TI-2026-97922 Out-of-bounds flash access via forged swap status in MCUboot CVSS 3.1MEDIUM 5.7
  • TI-2026-91073 Out-of-bounds read in MCUboot serial recovery image index CVSS 3.1MEDIUM 5.1
  • TI-2026-97925 Out-of-bounds read in MCUboot ECDSA signature parsing CVSS 3.1MEDIUM 4.0
See all 15 →

Sources