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

- **Severity:** HIGH 8.4
- **CVSS:** 8.4 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.40% (percentile 26, 2026-11-28)
- **CWE:** CWE-787
- **Published:** 2026-11-24T21:39:10.848Z
- **Modified:** 2026-11-24T23:13:18.710Z

## Who should check

- Anyone running mcu-tools mcuboot \>= 1.9.0, \< 2.5.1

## Description

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.

## Affected and fixed versions

- mcu-tools mcuboot: \>= 1.9.0, \< 2.5.1 (cvelist)

## Mitigation

- Upgrade mcuboot to 2.5.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-16663. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-16663.md
Affected: mcu-tools mcuboot >= 1.9.0, < 2.5.1
Fixed in: mcu-tools mcuboot 2.5.1

Steps:
1. Search this machine and project for mcu-tools mcuboot: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-16663 being exploited?

There is no confirmed exploitation: CVE-2026-16663 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.40% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-16663?

High: CVSS 8.4 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-16663?

mcu-tools mcuboot \>= 1.9.0, \< 2.5.1.

### Is there a fix for CVE-2026-16663?

Yes. Fixed in mcu-tools mcuboot 2.5.1. Upgrade mcuboot to 2.5.1 or later.

### How do I check if I'm affected by CVE-2026-16663?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/mcu-tools/mcuboot/security/advisories/GHSA-7c8v-m3pm-wh74>
- patch: <https://github.com/mcu-tools/mcuboot/commit/6e1465c38e3dba4849caed650ad83d0ba5c277b6>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-16663>
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-16663> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-16663>
