CVE-2026-16662: Uninitialised bootloader stack disclosed into the measured-boot attestation record via a short EXPECTED_HASH TLV in MCUboot

Published Nov 13, 2026
·
Updated

bootsavebootstatus() in boot/bootutil/src/bootrecord.c reads the image's EXPECTEDHASHTLV into a stack buffer imagehash[IMAGEHASHSIZE] that is never zero-initialised. The TLV handler validates only the upper bound (len > sizeof(imagehash)) and then reads exactly len bytes, so a TLV shorter than IMAGEHASHSIZE leaves the tail of imagehash holding stale stack content. The subsequent copy into the boot record, memcpy(buf + offset, imagehash, sizeof(imagehash)), uses the fixed buffer size rather than len, so up to IMAGEHASHSIZE - 1 bytes of uninitialised bootloader stack are written into the measured-boot record.

The defect is reachable only under MCUBOOTMEASUREDBOOT, and only when the image reaching bootsavebootstatus() was not hash-validated on that boot. bootutilimgvalidate() rejects a hash TLV whose length is not exactly sizeof(hash) (boot/bootutil/src/imagevalidate.c:345), and primary-slot validation is on by default (Zephyr's CONFIGBOOTVALIDATESLOT0 defaults to y), so in a default build the malformed image never reaches this code. The direct-XIP and RAM-load strategies in boot/bootutil/src/loader.c validate the selected slot unconditionally and are not affected. The short TLV survives only where the integrator has turned primary-slot validation off: the swap and overwrite loader built without MCUBOOTVALIDATEPRIMARYSLOT, which checks only the image magic before calling bootaddshareddata(), and the Zephyr single-slot loader (boot/zephyr/singleloader.c) built without it, including the MCUBOOTVALIDATEPRIMARYSLOTONCE variant, which skips validation once the trailer records an earlier successful one. It is also reachable through a time-of-check/time-of-use change to tamperable external flash between validation and the boot-record read. Placing the crafted image requires physical or flash-write access to the device; in a single-slot build with serial recovery enabled, the serial-recovery upload writes the primary slot directly and can place it as well.

In these configurations the boot record's measurement is already not trustworthy: with validation off, the hash copied into the record is the image's own unverified EXPECTEDHASHTLV, which the attacker chooses. The defect therefore does not weaken attestation integrity any further. What it adds is a path for bootloader memory to leave the device: up to 63 bytes (IMAGEHASHSIZE - 1) of uninitialised bootloader stack are embedded in the measurement field that a downstream attestation service sends to a remote verifier. In the configurations analysed the residue is bootloader internal state (TLV offsets and lengths, flash addresses, loop state), not key material, but what occupies that stack region depends on configuration and on which code ran before bootsavebootstatus(). It is reported as a low-severity, defense-in-depth disclosure with no integrity or availability impact.

This is distinct from the already-fixed recordlen integer underflow in the same routine (GHSA-8hrv-4cp5-4rg3). The fix rejects any EXPECTEDHASHTLV whose length is not exactly IMAGEHASHSIZE.

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Enable primary-slot validation so the selected image is hash-validated before boot_add_shared_data(); in Zephyr, use CONFIG_BOOT_VALIDATE_SLOT0=y.

    MCUboot primary-slot validation MCUBOOT_VALIDATE_PRIMARY_SLOT = enabled

Event History

Nov 13, 2026
CVE Published
via MITRE·12:23 AM
Data Sourced
via MITRE·12:23 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:18 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Are default MCUboot builds exposed to this issue?

A default Zephyr build is not expected to reach the vulnerable path because CONFIG_BOOT_VALIDATE_SLOT0 defaults to enabled, and validation rejects an EXPECTED_HASH TLV whose length is not exactly the hash size. The issue also requires MCUBOOT_MEASURED_BOOT to be enabled.

2

What conditions are required for a disclosure to occur?

An image with an EXPECTED_HASH TLV shorter than IMAGE_HASH_SIZE must reach boot_save_boot_status() without having its hash validated during that boot. This causes the unwritten portion of the stack buffer to be copied into the measured-boot record.

3

Which boot strategies avoid the vulnerable path for a selected image?

The direct-XIP and RAM-load strategies validate the selected slot unconditionally. Their validation rejects a short hash TLV before it can reach the affected record-writing code.

4

What can be done if an update cannot be applied immediately?

Ensure images are hash-validated before they reach boot_save_boot_status(), including keeping primary-slot validation enabled. Disabling measured boot also removes the required MCUBOOT_MEASURED_BOOT condition for this disclosure path.

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