← ALL ADVISORIES

LOW BYTERAY-2026-0518Disclosed

wolfSSL — Missing Zeroization of Session Ticket and Ticket Nonce on Session Free and Cache Eviction

wolfSSL_FreeSession clears the master secret and session id before freeing a session but releases the heap-allocated session ticket and TLS 1.3 ticket nonce without clearing them. EvictSessionFromCache has the same gap. Ticket material remains in freed heap memory.

Advisory
BYTERAY-2026-0518
CWE
CWE-226
CVSS
3.7 (CVSS:3.1/AV:N/AC:H/PR:N/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 HAVE_SESSION_TICKET (--enable-session-ticket); the nonce release also needs WOLFSSL_TICKET_NONCE_MALLOC
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

When wolfSSL frees a TLS session it clears the most sensitive fields first. wolfSSL_FreeSession() calls ForceZero() on the master secret and the session id.

The session ticket and its TLS 1.3 nonce are not included. When they are held in heap buffers, both are released with a plain XFREE() a few lines earlier. The cache eviction routine EvictSessionFromCache() frees the same two buffers the same way. Eviction runs on cache timeouts, explicit session removal and cache teardown.

The freed memory holds server-issued ticket material. A ticket cannot be used for resumption without the master secret, which is the field that is cleared. Session ticket support is off by default in this tree, so default builds are not affected.

Affected Products and Versions

  • Component: src/ssl_sess.c, wolfSSL_FreeSession() and EvictSessionFromCache().
  • Required build: HAVE_SESSION_TICKET. --enable-session-ticket is off by default (configure.ac:9469-9473). The nginx, wpa_supplicant, haproxy and lighttpd options turn it on (configure.ac:9475-9478).
  • The ticket nonce release also needs WOLFSSL_TLS13 and WOLFSSL_TICKET_NONCE_MALLOC (configure.ac:9485-9488).
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default ./configure build does not include this code. Other releases were not checked.

Technical Details

In wolfSSL_FreeSession() the order is:

  1. The dynamic session ticket is freed at src/ssl_sess.c:4329, with no overwrite.
  2. The dynamic ticket nonce is freed at src/ssl_sess.c:4337-4338, with no overwrite.
  3. The master secret and the session id are cleared (src/ssl_sess.c:4349-4352):
    /* Make sure masterSecret is zeroed. */
    ForceZero(session->masterSecret, SECRET_LEN);
    /* Session ID is sensitive information too. */
    ForceZero(session->sessionID, ID_LEN);
  1. A heap session object is then freed (src/ssl_sess.c:4354-4356).

EvictSessionFromCache() follows the same shape. It clears the master secret (src/ssl_sess.c:80), then frees the stored ticket at src/ssl_sess.c:85 and the stored nonce at src/ssl_sess.c:101, neither one cleared.

The scrub that sits next to these frees shows that sensitive session fields are meant to be cleared on release. The ticket and nonce buffers were left out.

Reachability and Preconditions

  • Build with HAVE_SESSION_TICKET. For the nonce, also WOLFSSL_TICKET_NONCE_MALLOC.
  • The session holds a ticket larger than the inline buffer, or a nonce larger than the inline nonce buffer.
  • The frees run in normal operation: when a session object is freed, when a cached session times out, when wolfSSL_CTX_remove_session() is called, and when the cache is torn down. A TLS peer decides the size of the tickets it issues.
  • Disclosure needs a second condition outside this issue: the freed block is reused in the same process and something exposes the reused memory.

Impact

Session tickets and ticket nonces persist in freed heap memory after the session is gone. Resumption needs the master secret, or in TLS 1.3 the resumption secret together with the nonce, and the master secret is cleared. The consequence is a confidentiality-only exposure of ticket material that depends on a separate memory-disclosure primitive.

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 to call ForceZero() on the ticket over its recorded length, and on the nonce, before each free in wolfSSL_FreeSession() and EvictSessionFromCache(). Clearing the session object before its final free would also cover any other field left in it. Builds without session ticket support are not affected. There is no runtime workaround for builds that need tickets.

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