wolfSSL — Missing Ticket Expiry Check in TLS 1.2 Session-Secret Callback Resumption
When a server application supplies the master secret through a session-secret callback, the TLS 1.2 resumption code marks the peer as authenticated and returns before the ticket expiry check. An expired ticket that still decrypts completes resumption with the peer-authentication flag set.
- Advisory
- BYTERAY-2026-0470
- CWE
- CWE-267
- 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), TLS 1.2 servers built with HAVE_SECRET_CALLBACK and session tickets that register a session-secret callback
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
A wolfSSL server built with HAVE_SECRET_CALLBACK can register a session-secret callback with wolfSSL_set_session_secret_cb(). For a presented session ticket, the application then supplies the master secret.
In that mode HandleTlsResumption() in src/internal.c calls the callback, derives keys, sets ssl->options.peerAuthGood and returns. The ticket expiry check sits later in the same function. On the other resumption paths that check declines a stale ticket and clears the flag, with the comment that a declined ticket must not satisfy client authentication. On the callback path it is never reached. The ticket decryption routine has no lifetime check of its own.
An expired ticket that still decrypts therefore completes the abbreviated handshake with the flag set. On a listener that requires client certificates, the client is accepted without a certificate request. Two things limit this. Tickets remain bound to their SNI and ALPN values by an earlier check. And in callback mode the application is the authority for session validity. Default builds do not define HAVE_SECRET_CALLBACK.
Affected Products and Versions
- Component:
src/internal.c,HandleTlsResumption(), theHAVE_SECRET_CALLBACKbranch. - Required build:
HAVE_SECRET_CALLBACKandHAVE_SESSION_TICKET, server side, TLS 1.2 and below, with a callback registered throughwolfSSL_set_session_secret_cb(). - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default build does not include this branch.
- Other releases were not checked.
Technical Details
The extended-master-secret declines run first (src/internal.c:41596-41615). The callback branch follows (src/internal.c:41618-41655). It is entered when a callback is registered and the client presented a ticket (src/internal.c:41619-41623):
/* SERVER: peer auth based on session secret. */
ssl->options.peerAuthGood = (ret == 0);
ssl->options.clientState = CLIENT_KEYEXCHANGE_COMPLETE;
}
...
return ret;
The grant is at src/internal.c:41648 and the unconditional return at src/internal.c:41654. The expiry decline is below it, at src/internal.c:41699-41707. It sets ssl->options.resuming = 0 and ssl->options.peerAuthGood = 0 when LowResTimer() > session->bornOn + ssl->timeout.
- A client sends a ClientHello with a session ticket.
DoDecryptTicket()(src/internal.c:43599-43671) decrypts it and applies no lifetime check. VerifyTicketBinding()runs inDoClientHello()(src/internal.c:42377-42384) whenever a ticket is used. A ticket with an SNI or ALPN mismatch is declined there, beforeHandleTlsResumption()is called.- In
HandleTlsResumption()the callback branch invokes the callback (src/internal.c:41629), derives keys, setspeerAuthGoodand returns. The expiry decline does not run. wolfSSL_accept()skipsSendCertificateRequest()because the handshake is a resumption (src/ssl_api_hs.c:1037-1049).- The client-authentication fail-safe (
src/ssl_api_hs.c:1112-1117) passes because the flag is already set.
Reachability and Preconditions
- Build:
HAVE_SECRET_CALLBACKwith session tickets. Not a default configuration. - Runtime: the server application has registered a session-secret callback. The callback returns a secret for the stale ticket.
- Attacker position: a remote client holding a ticket issued by the deployment more than
ssl->timeoutseconds ago that still decrypts under the server's ticket key. No other credential is needed. - For a client-authentication consequence, the accepting connection must require a client certificate while the ticket was issued under a different or earlier policy. This is the condition described in BYTERAY-2026-0304.
Impact
An expired ticket is honoured on this path, which the other resumption paths refuse. Where the accepting connection requires a client certificate and the ticket came from a context that did not, the client is accepted without presenting one. There is no availability impact. The practical exposure is narrow. A non-default build option, an explicit callback registration and the cross-policy condition are all required, and the callback owner can enforce lifetime itself.
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 a reorder: run the ticket lifetime check before the HAVE_SECRET_CALLBACK branch and apply the same decline as the other paths, clearing resuming and peerAuthGood for a stale ticket. An alternative is to let the callback report an invalid or expired session and treat that as a decline. A fix limited to the other grant sites leaves this one in place.
Workaround: have the session-secret callback check the age of the session and return an error for an expired one.
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.