wolfSSL — Missing Future Timestamp Check in TLS 1.2 Session Ticket Expiry
The TLS 1.2 and DTLS 1.2 resumption path treats a session as expired only when the server clock is past its creation time plus the timeout. A ticket whose creation time is ahead of the clock, as after a backward clock step, is never rejected and resumes beyond its intended lifetime.
- Advisory
- BYTERAY-2026-0538
- CWE
- CWE-324
- 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 and DTLS 1.2 servers that resume from session tickets, after a backward step of the server clock
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
When a wolfSSL server resumes a TLS 1.2 or DTLS 1.2 session, HandleTlsResumption() decides whether the session has expired. It does so with one comparison: the current time against the session's creation time plus the timeout.
The comparison has no lower bound. A creation time that lies in the future relative to the server clock is accepted. For a session ticket, the creation time comes from inside the ticket. It is protected by the ticket encryption and cannot be forged, but it is a wall-clock value taken when the ticket was issued.
If the server clock steps backwards, by an NTP correction, a manual change or a virtual machine rollback, every ticket issued before the step looks younger than it is. Tickets stay resumable for longer than the timeout by about the size of the step, and with a large enough step that includes tickets that had already expired. The client needs no crafted input. It reconnects with its genuine ticket. On a server that requires client certificates, the resumed session counts as authenticated. The check is the same in every build with session tickets.
Affected Products and Versions
- Component:
src/internal.c,HandleTlsResumption(), the server-side resumption path for TLS 1.2 and DTLS 1.2. - Required build: session tickets. The default ticket encryption callback is sufficient (
src/internal.c:2997). No application callback is needed. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- No option beyond session ticket support is required. The condition arises only after the server clock moves backwards. Builds with
WOLFSSL_NO_TICKET_EXPIREorNO_ASN_TIMEhave no expiry check at all, by configuration. - Other releases were not checked.
Technical Details
The expiry check (src/internal.c:41699-41707):
if (LowResTimer() > session->bornOn + ssl->timeout) {
WOLFSSL_MSG("Expired session, fall back to full handshake.");
ssl->options.resuming = 0;
ssl->options.peerAuthGood = 0;
}
This is an upper bound only. Nothing tests session->bornOn > LowResTimer().
How the values get there:
- The client sends its ticket in the SessionTicket extension.
DoClientTicket()decrypts it, and the parser setsuseTicket,resumingandpeerAuthGood(src/tls.c:6618-6624). DoClientTicketFinalize()restoresbornOnfrom the timestamp in the ticket (src/internal.c:43923).DoClientHello()callsHandleTlsResumption()(src/internal.c:42489-42490), which applies the comparison atsrc/internal.c:41701.- Both operands are the server's own: its clock and a timestamp it wrote. After the clock steps back by R seconds, a ticket issued at time T is not treated as expired until the clock again passes T plus the timeout. That is about R seconds later than intended.
- The abbreviated handshake proceeds with
peerAuthGoodstill set, which satisfies the test that client authentication took place (src/ssl_api_hs.c:1112-1117).
The DTLS 1.2 resume decision used with WOLFSSL_DTLS_NO_HVR_ON_RESUME accepts a decrypted ticket without a timestamp test of either kind (src/dtls.c:448-453).
Reachability and Preconditions
- A server with TLS 1.2 or DTLS 1.2 session tickets enabled.
- The server clock has stepped backwards. The client cannot cause this.
- The client holds a ticket issued before the step. It presents the ticket bytes unchanged.
- No privilege is needed beyond having obtained the ticket in an earlier handshake.
Impact
A session credential is used past its expiration. A ticket remains resumable for about the size of the clock step beyond its timeout, and the client only prolongs a capability it already held. Where expiry is relied on to end access, for example after an identity has been removed, that is deferred for the same period. During it the resumed session passes the client-authentication check on servers that require client certificates. No ticket content is forged and no other identity is gained. A backward clock step lengthens the apparent life of any timestamped credential. The specific gap here is that a timestamp from the future, which is direct evidence of the step, is accepted without question.
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 reject a session whose bornOn is later than the current time, alongside the existing expiry test, with a tolerance of a few seconds for ordinary clock skew. The same rejection belongs in the DTLS 1.2 resume decision in src/dtls.c. Mitigation: keep ticket lifetimes short, and do not build with WOLFSSL_NO_TICKET_EXPIRE where expiry matters, since this comparison is the only age control on TLS 1.2 resumption.
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.