← ALL ADVISORIES

LOW BYTERAY-2026-0528Disclosed

wolfSSL — Triple-DES Key Material Not Cleared by wc_Des3Free in the TI Crypto Port

In builds with WOLFSSL_TI_CRYPT, wc_Des3Free is an empty function. The TI key setup copies the raw 24-byte Triple-DES key into the Des3 context, so the key stays in memory after the context is freed. The generic implementation clears the same context with ForceZero.

Advisory
BYTERAY-2026-0528
CWE
CWE-733
CVSS
2.5 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N)
Vendor
wolfSSL
Product
wolfSSL
Reported
2026-09-28
Disclosure
2026-12-03
Affected
wolfSSL 5.9.2 (tested at master commit d95483f), builds with WOLFSSL_TI_CRYPT (Texas Instruments hardware crypto port) that use Triple-DES
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

When wolfSSL is built with the Texas Instruments hardware crypto port (WOLFSSL_TI_CRYPT), the generic DES and Triple-DES code is replaced by a TI-specific file. That file supplies its own wc_Des3Free(), and the function is an empty stub.

The TI key setup copies the raw key into the context structure. On these builds a Triple-DES key therefore remains intact inside the Des3 structure after the TLS layer or the application has freed it. The generic wc_Des3Free() clears the structure with ForceZero(), but the preprocessor excludes it from TI builds.

Recovering a key needs a separate way to read that memory, and Triple-DES has to be in use. Default builds do not compile the TI port.

Affected Products and Versions

  • Component: wolfcrypt/src/port/ti/ti-des3.c, wc_Des3Free().
  • Required build: WOLFSSL_TI_CRYPT with DES3 enabled.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default build does not define WOLFSSL_TI_CRYPT and is not affected.
  • Other releases were not checked.

Technical Details

The TI teardown is the whole of wolfcrypt/src/port/ti/ti-des3.c:196-199:

WOLFSSL_API void wc_Des3Free(Des3* des)
{
    (void)des;
}

How key material ends up in a context that is never cleared:

  1. With WOLFSSL_TI_CRYPT, wolfcrypt/src/des3.c includes the TI port in place of its own body (wolfcrypt/src/des3.c:58-60). The generic wc_Des3Free() (wolfcrypt/src/des3.c:2089-2105), which clears des3->devKey where present and then the whole structure with ForceZero(des3, sizeof(Des3)), is in the #else branch that closes at wolfcrypt/src/des3.c:2107. It is not compiled.
  2. The TI key setup stores the raw key in the context: XMEMCPY(des->key, key, tri == DES_CFG_SINGLE ? DES_KEYLEN : DES3_KEYLEN) (wolfcrypt/src/port/ti/ti-des3.c:68). For Triple-DES that is 24 bytes.
  3. The TLS layer or the application calls wc_Des3Free() when it is done with the context. The call returns without touching it.
  4. The Des3 structure is freed or goes out of scope with the key still in it.

The generic function shows that the context is expected to be wiped on release. Only one of the two implementations does it.

Reachability and Preconditions

  • Build: WOLFSSL_TI_CRYPT, used on TI microcontrollers with hardware crypto. Off by default.
  • Triple-DES must be used, through a 3DES cipher suite or through direct wolfCrypt calls. 3DES suites are deprecated and usually disabled.
  • The attacker needs an independent memory-disclosure primitive against the device or process, such as a heap over-read or a memory dump.
  • No protocol input changes whether the key persists. It always does on this build.

Impact

A Triple-DES key remains in memory after its context is released. An attacker who can later read that memory can recover the key. Only key confidentiality is at stake, and only on TI builds that still use Triple-DES.

ByteRay did not build a proof of concept for this issue. The analysis is from source review.

Remediation and Mitigation

ByteRay has not confirmed a fixed wolfSSL release for this issue as of 2026-12-03, and has not checked it against wolfSSL changes made after the tested commit.

The fix direction is for the TI wc_Des3Free() to clear the context with ForceZero(des, sizeof(Des3)), as the generic function does. Sharing one teardown between the generic and TI implementations would keep the two from diverging again. As a workaround, disable Triple-DES on WOLFSSL_TI_CRYPT builds (NO_DES3), or have the application zero its own Des3 objects after calling wc_Des3Free(), with a wipe the compiler cannot remove.

Timeline

  • 2026-09-28 — Reported to wolfSSL.
  • 2026-12-03 — Public disclosure.

Credits

Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.

References