Request an audit

// CVE · Published · Mbed TLS

CVE-2026-35336Medium

Mbed TLS ECDH calc_secret buffer overflow.

Possible buffer overflow in mbedtls_ecdh_calc_secret() when the output buffer is too small - up to remote code execution.

Published
Vendor
Product
Mbed TLS
Affected
Mbed TLS up to 3.6.6
Fixed in
Mbed TLS 3.6.7 (4.0 and later not affected)
Research area
Credit
Eva Crystal (0xiviel), XSource Security

Summary

mbedtls_ecdh_calc_secret() checks that the output buffer is large enough for the shared secret, but the check was computed from the secret’s significant bytes. When the most significant bytes of the secret happened to be zero the check passed for a buffer that was too small, while the function still wrote the full width of the curve. Instead of returning an error it wrote past the end of the caller’s buffer.

Impact

A stack or heap overflow that fires probabilistically, on secrets with leading zero bytes, in code that passes an undersized buffer. The Mbed TLS advisory rates it Medium and puts the consequence anywhere from a crash to arbitrary code execution, depending on what sits after the buffer.

Affected and fixed

  • Affected: all Mbed TLS versions up to 3.6.6
  • Not affected: Mbed TLS 4.0 and later, TF-PSA-Crypto (the API does not exist there)
  • Fixed: Mbed TLS 3.6.7
  • Work-around: pass a buffer of at least (bits + 7) / 8 bytes for the curve in use

Timeline

  • 7 Jul 2026: Mbed TLS security advisory published with CVE-2026-35336

Credit

Reported by Eva Crystal (0xiviel), founder of XSource Security, as credited in the advisory.

More disclosures

All disclosures →

Published · NVD
CVE-2026-34876

Mbed TLS out-of-bounds read

Out-of-bounds read in mbedtls_ccm_finish(): an oversized tag_len in the multipart CCM API exposes adjacent CCM context data. Discovered through the Intigriti Trusted Firmware program.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
7.5 · High · CVSS 3.1