GHSA-779w-4x76-5chf: 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.

Affected Software

1 affected component
MCUboot MCUboot

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    Reject any EXPECTED_HASH_TLV whose length is not exactly IMAGE_HASH_SIZE before reading it into image_hash.

Event History

Nov 13, 2026
CVE Published
via OSV·12:23 AM
Data Sourced
via OSV·12:23 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Are default MCUboot builds affected?

Typically no. The issue requires MCUBOOT_MEASURED_BOOT and an image that reaches boot_save_boot_status() without hash validation; primary-slot validation is enabled by default through Zephyr's CONFIG_BOOT_VALIDATE_SLOT0=y, which rejects a hash TLV unless its length exactly matches the hash size.

2

What must an attacker-controlled image contain to trigger the disclosure?

It must contain an EXPECTED_HASH TLV shorter than IMAGE_HASH_SIZE and must reach boot_save_boot_status() without having been hash-validated on that boot. A normally validated image with that malformed TLV is rejected by bootutil_img_validate().

3

Which boot strategies are protected by unconditional validation?

The direct-XIP and RAM-load strategies validate the selected slot unconditionally. The provided information indicates that these strategies do not permit the malformed hash TLV to reach the affected copy operation.

4

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

Ensure image hash validation remains enabled before an image can reach boot_save_boot_status(), and avoid configurations in which measured boot processes images that were not hash-validated. This prevents a short EXPECTED_HASH TLV from reaching the vulnerable path.

5

How can I determine whether my configuration is exposed?

Check whether MCUBOOT_MEASURED_BOOT is enabled and whether any boot flow can invoke boot_save_boot_status() for an image that was not hash-validated during that boot. Also verify that validation equivalent to CONFIG_BOOT_VALIDATE_SLOT0 remains enabled for the relevant image slot.

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