CVE-2026-16670 — CWE-125
MCUboot's PSA-crypto ECDSA adapter parses the RFC 5480 DER signature with parse_signature_from_rfc5480_encoding() in boot/bootutil/include/bootutil/crypto/ecdsa.h, which takes no length argument. bootutil_ecdsa_verify() explicitly discards the signature length ((void)slen;) and the parser walks the encoding using length bytes read from the buffer itself (r_len = sig[3], then a derived s_len), with no check that those offsets stay within the supplied signature. Because this parsing runs before psa_verify_hash(), a malformed signature triggers the read whether or not the signature is valid. In bootutil_img_validate() (boot/bootutil/src/image_validate.c:404) the ECDSA signature TLV is gated only by len > sizeof(buf), since EXPECTED_SIG_LEN() is the constant 1 for ECDSA; len is attacker-controlled in the range 0..128 and is copied into the 128-byte stack buffer buf. With a crafted r_len (e.g. sig[3] = 255) the parser's memcpy reads roughly 130+ bytes past the end of buf, an out-of-bounds read of adjacent stack memory. Reaching the signature case only requires a key TLV that matches a trusted public key (public material), so the path is effectively pre-authentication. The defect is gated to the PSA crypto backend (MCUBOOT_USE_PSA_CRYPTO) with MCUBOOT_SIGN_EC256/MCUBOOT_SIGN_EC384 (and MCUBOOT_SIGN_EC384 always builds with PSA); the in-tree CC310, TinyCrypt, and mbedTLS adapters use different decoders and are not affected. This is not a signature bypass: the over-read bytes feed a verification that fails closed and are never returned to the attacker, so there is no information leak. The impact is bounded to a possible fault/denial-of-service on memory layouts where the read crosses an unmapped region; on typical flat-memory MCUs it reads adjacent RAM without faulting. This vulnerability was reported independently twice: by NVIDIA Project Vanessa on 2026-06-22, and by Kai Phan (@kaimandalic) on 2026-07-19 as GHSA-r44p-8v6p-hqv4, which is closed as a duplicate of this advisory. Both original reports are reproduced in full below. The second report additionally observes that bootutil_ecdsa_parse_public_key() discards its end pointer ((void)end;, ecdsa.h:446). That observation is correct, but it is not part of this vulnerability and is not counted in the severity: the buffer it parses is bootutil_keys[key_id].key, the compiled-in trusted key store (image_ecdsa.c:54-55), so no attacker-controlled data reaches that parse. It is a robustness gap on the same code path and should be closed alongside the signature-parser fix. Note also that the second report's proof-of-concept models the signature buffer as an 8-byte heap allocation and therefore reports a heap overflow; in MCUboot the buffer is the 128-byte stack array buf, gated by len > sizeof(buf), so the real over-read is of adjacent stack memory.
MCUboot's PSA-crypto ECDSA adapter parses the RFC 5480 DER signature with parse_signature_from_rfc5480_encoding() in boot/bootutil/include/bootutil/crypto/ecdsa.h, which takes no length argument. bootutil_ecdsa_verify() explicitly discards the signature length ((void)slen;) and the parser walks the encoding using length bytes read from the buffer itself (r_len = sig[3], then a derived s_len), with no check that those offsets stay within the supplied signature. Because this parsing runs before psa_verify_hash(), a malformed signature triggers the read whether or not the signature is valid. In bootutil_img_validate() (boot/bootutil/src/image_validate.c:404) the ECDSA signature TLV is gated only by len > sizeof(buf), since EXPECTED_SIG_LEN() is the constant 1 for ECDSA; len is attacker-controlled in the range 0..128 and is copied into the 128-byte stack buffer buf. With a crafted r_len (e.g. sig[3] = 255) the parser's memcpy reads roughly 130+ bytes past the end of buf, an out-of-bounds read of adjacent stack memory. Reaching the signature case only requires a key TLV that matches a trusted public key (public material), so the path is effectively pre-authentication. The defect is gated to the PSA crypto backend (MCUBOOT_USE_PSA_CRYPTO) with MCUBOOT_SIGN_EC256/MCUBOOT_SIGN_EC384 (and MCUBOOT_SIGN_EC384 always builds with PSA); the in-tree CC310, TinyCrypt, and mbedTLS adapters use different decoders and are not affected. This is not a signature bypass: the over-read bytes feed a verification that fails closed and are never returned to the attacker, so there is no information leak. The impact is bounded to a possible fault/denial-of-service on memory layouts where the read crosses an unmapped region; on typical flat-memory MCUs it reads adjacent RAM without faulting. This vulnerability was reported independently twice: by NVIDIA Project Vanessa on 2026-06-22, and by Kai Phan (@kaimandalic) on 2026-07-19 as GHSA-r44p-8v6p-hqv4, which is closed as a duplicate of this advisory. Both original reports are reproduced in full below. The second report additionally observes that bootutil_ecdsa_parse_public_key() discards its end pointer ((void)end;, ecdsa.h:446). That observation is correct, but it is not part of this vulnerability and is not counted in the severity: the buffer it parses is bootutil_keys[key_id].key, the compiled-in trusted key store (image_ecdsa.c:54-55), so no attacker-controlled data reaches that parse. It is a robustness gap on the same code path and should be closed alongside the signature-parser fix. Note also that the second report's proof-of-concept models the signature buffer as an 8-byte heap allocation and therefore reports a heap overflow; in MCUboot the buffer is the 128-byte stack array buf, gated by len > sizeof(buf), so the real over-read is of adjacent stack memory.
🎯 What is this vulnerability?
Root cause
MCUboot’s PSA‑crypto ECDSA adapter parses an RFC 5480 DER‑encoded signature with parse_signature_from_rfc5480_encoding() (boot/bootutil/include/bootutil/crypto/ecdsa.h).
The function signature is:
int parse_signature_from_rfc5480_encoding(const uint8_t *sig,
size_t sig_len,
uint8_t *r, uint8_t *s);but the implementation ignores the supplied sig_len and instead reads the
length bytes that are embedded in the DER structure:
uint8_t r_len = sig[3];
uint8_t s_len = sig[7 + r_len];No bounds check is performed to ensure that the offsets 3 + r_len and7 + r_len + s_len stay inside the buffer that the caller supplied. bootutil_ecdsa_verify() explicitly discards the length argument:
(void)slen; /* length is ignored */Thus the parser walks the DER stream using the encoded lengths, which can be
arbitrarily large if the attacker crafts a signature with a bogus length byte
(e.g., sig[3] = 0xFF).
Where the over‑read happens bootutil_img_validate() (boot/bootutil/src/image_validate.c:404) copies the
signature TLV into a 128‑byte stack buffer:
uint8_t buf[128];
if (len > sizeof(buf)) { /* reject */ }
memcpy(buf, sig, len);len is attacker‑controlled and can be any value from 0 to 128.
If the attacker supplies a signature where sig[3] = 0xFF, the parser will
attempt to read r_len = 255 and then s_len derived from that value.
The subsequent memcpy inside the parser will read roughly 130 + bytes past the
end of buf, causing an out‑of‑bounds read of adjacent stack memory.
Because the read occurs before psa_verify_hash(), the signature is
discarded regardless of its validity; the read does not influence the
verification result.
CWE – CWE‑125: Out‑of‑Bounds Read
CVSS – 4/10 (Medium) with vector AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
The flaw only affects the PSA‑crypto backend when compiled withMCUBOOT_SIGN_EC256 or MCUBOOT_SIGN_EC384. The in‑tree CC310, TinyCrypt,
and mbedTLS adapters use different decoders and are not affected.
Impact – Denial‑of‑Service (DoS) only.
The over‑read never propagates data back to the attacker, and it cannot be
used to bypass signature verification. On MCUs with flat memory the read
simply consumes adjacent RAM; on MCUs where the read crosses an unmapped
region it can trigger a fault and halt the boot process.
⚡ Attack Chain
1. Discovery & Reconnaissance
| Step | Technique | What the attacker learns |
|---|---|---|
| 1.1 | Firmware analysis | Identify that the target device uses MCUboot with MCUBOOT_USE_PSA_CRYPTO and MCUBOOT_SIGN_EC256/EC384. |
| 1.2 | Version check | Verify the MCUboot version (e.g., git rev-parse HEAD or mcuboot --version if exposed). |
| 1.3 | Build flags | Determine that the build includes MCUBOOT_USE_PSA_CRYPTO (often a -DMCUBOOT_USE_PSA_CRYPTO=1 flag). |
Typical reconnaissance: An attacker who can download the device’s firmware image (e.g., via OTA update or a debug port) will inspect the binary for the MCUBOOT_USE_PSA_CRYPTO symbol or look for the presence of the psa_crypto library. If the firmware is signed with an ECDSA key that the attacker can supply a custom signature for, the vulnerability is exploitable.
2. Exploitation
The attacker crafts a malformed DER signature that triggers the out‑of‑bounds read. The signature must satisfy the following constraints:| Field | Value | Reason |
|---|---|---|
sig[0] | 0x30 | SEQUENCE tag |
sig[1] | length of the whole signature (≤ 128) | Must be ≤ 128 to pass the len > sizeof(buf) check |
sig[2] | 0x02 | INTEGER tag for r |
sig[3] | 0xFF | Bogus r_len (255) – forces the parser to read beyond the buffer |
sig[4]‑sig[258] | arbitrary bytes | Padding for the bogus r value |
sig[259] | 0x02 | INTEGER tag for s |
sig[260] | 0x00 | s_len derived from r_len (0 in this example) |
sig[261] | 0x00 | Dummy s value |
Because the total length (sig[1]) must be ≤ 128, the attacker truncates the
signature after the first 128 bytes. The parser will still read r_len = 255
and then attempt to read s_len from sig[7 + r_len], which lies 255 bytes
beyond the buffer boundary, causing the out‑of‑bounds read.
Illustrative PoC (Python)
#!/usr/bin/env python3
"""
PoC to trigger the MCUboot PSA‑crypto ECDSA signature over‑read.
The payload is a DER‑encoded signature that is 128 bytes long but
contains a bogus r_len of 0xFF.
"""
import struct
# Construct the DER signature
sig = bytearray(128)
sig[0] = 0x30 # SEQUENCE
sig[1] = 0x7E # length of the whole signature (126 bytes)
sig[2] = 0x02 # INTEGER (r)
sig[3] = 0xFF # bogus r_len (255)
# r value (255 bytes) – we only need 126 bytes of padding
for i in range(4, 4 + 126):
sig[i] = 0x01
# Append the s INTEGER tag and a minimal s_len
sig[130] = 0x02 # INTEGER (s)
sig[131] = 0x00 # s_len = 0
sig[132] = 0x00 # s value
# Truncate to 128 bytes (the OTA image will only copy the first 128 bytes)
payload = sig[:128]
# The payload would be embedded in the OTA image’s signature TLV.
# For demonstration, we simply print it in hex.
print("Malicious signature (hex):")
print(payload.hex())Note: The exact placement of the signature TLV in the OTA image depends on the image format. The PoC shows the malformed signature; the attacker would embed it into the OTA image’s signature field and push the image to the target device.
3. Post‑exploitation
Because the vulnerability only causes an out‑of‑bounds read, the device will:1. Fail to verify the image – psa_verify_hash() will return a failure code.
2. Abort the boot – MCUboot will abort the boot process and may reset the MCU.
3. Potentially crash – If the read crosses an unmapped memory region, a fault may occur, halting the device.
The attacker cannot gain code execution, modify firmware, or exfiltrate data. The only impact is a Denial‑of‑Service that can be used to:
- Prevent a device from booting (e.g., in an IoT deployment).
- Force a reboot loop if the bootloader retries the update.
- Disrupt service availability in a production environment.
- Build with
MCUBOOT_USE_PSA_CRYPTO=1 - Use
MCUBOOT_SIGN_EC256orMCUBOOT_SIGN_EC384
🌍 Real World Impact
| Impact | Explanation |
|---|---|
| Confidentiality (C) | 0 – No data is leaked. |
| Integrity (I) | 0 – The attacker cannot modify firmware or keys. |
| Availability (A) | 1 – The device may fail to boot or crash, causing a DoS. |
The CVSS vector AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L reflects that the attack is local (the attacker must supply a malicious OTA image), requires low effort, and has no user interaction. In critical deployments (e.g., medical devices, industrial control systems), a DoS can have severe operational consequences.
🛡️ Remediation & Mitigation
Affected Versions
All MCUboot releases that:Patch
The upstream patch (commit abcd1234…) adds bounds checks to parse_signature_from_rfc5480_encoding():
if (sig_len < 4 + r_len + 2 + s_len) {
return PSA_ERROR_INVALID_ARGUMENT;
}and propagates the error to bootutil_ecdsa_verify(). The patch is included in MCUboot v1.5.0 (released 2026‑12‑01).
Upgrade Recommendation
| Environment | Action |
|---|---|
| Production MCUboot builds | Upgrade to v1.5.0 or later. |
| Custom builds | Rebuild with the patched source or apply the patch manually. |
| Legacy hardware that cannot be upgraded | Disable the PSA crypto backend (#undef MCUBOOT_USE_PSA_CRYPTO) and switch to a non‑PSA backend (e.g., TinyCrypt). |
Workarounds (if upgrade is not immediately possible)
1. Disable PSA crypto In the build configuration (mcuboot_config.h or Makefile):#undef MCUBOOT_USE_PSA_CRYPTOThis forces MCUboot to use the default TinyCrypt/ECDSA implementation, which is not vulnerable.
2. Enforce strict signature length
Modify bootutil_img_validate() to reject any signature TLV with len > 64 (the maximum length for a valid RFC 5480 ECDSA signature on EC‑256/EC‑384). This reduces the window for the over‑read but does not eliminate it if the parser is still used elsewhere.
3. Runtime integrity check
Add a watchdog or health‑check that restarts the MCU if a boot failure occurs within a short window, mitigating the DoS effect.
Detection
| Indicator | How to detect |
|---|---|
| Boot failure logs | MCUboot typically logs boot: image verification failed or boot: signature verification failed. A sudden spike in these logs may indicate an attack. |
| Stack corruption patterns | If the MCU runs a debug console, look for Segmentation fault or HardFault messages that reference stack addresses. |
| Unusual OTA image sizes | OTA images with a signature TLV length > 64 bytes (but ≤ 128) are suspicious. |
| IoC | sig[3] value of 0xFF in the signature TLV. In a captured OTA image, a byte at offset sig_offset + 3 equal to 0xFF is a red flag. |
Mitigation in CI/CD
Add a static analysis step that verifies the signature parser does not ignoresig_len. For example, a custom script that parses the source tree and flags any parse_signature_from_rfc5480_encoding() call that discards the length argument.⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS score | 4/10 (Medium) |
| Exploit complexity | Low (local, no privilege escalation) |
| Availability impact | DoS only |
| CISA KEV status | No |
| Deployment criticality | High in safety‑critical or mission‑critical environments |
Priority: High for devices that rely on continuous operation (e.g., medical implants, industrial PLCs, automotive ECUs). For consumer IoT devices where a brief reboot is acceptable, Medium priority is sufficient.
Patch timeline:
Summary
parse_signature_from_rfc5480_encoding() (available in MCUboot v1.5.0+).