wolfSSL — Missing Lower Bound on Ticket Age in TLS 1.3 Session Ticket Validation
The TLS 1.3 ticket lifetime check in wolfSSL rejects tickets that are too old but not tickets whose timestamp is ahead of the server clock. After a backward clock step, a ticket holder can choose its obfuscated ticket age to pass the second age check and resume an expired ticket.
- Advisory
- BYTERAY-2026-0537
- 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.3 and DTLS 1.3 servers that resume from session tickets, after a backward step of the server clock or, in WOLFSSL_32BIT_MILLI_TIME builds, a millisecond clock wrap
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
A wolfSSL server decides whether a TLS 1.3 or DTLS 1.3 session ticket is still within its lifetime in DoClientTicketCheck(). The check computes the ticket's age as the server clock minus the timestamp stored in the ticket, and rejects the ticket if that age is above the session timeout or the seven-day maximum.
There is no test for a negative age. If the server clock steps backwards, by an NTP correction, a virtual machine rollback or a manual change, tickets issued before the step have timestamps in the server's future. Their age is negative and passes. A second check compares the result with the age the client claims. Both values in that comparison are known to the client, so a client holding such a ticket can choose its claimed age to land inside the accepted window.
The result is that a ticket past its lifetime is resumed, with peer authentication taken from the ticket and early data enabled again. Only the holder of a genuinely issued ticket can do this, and only after a clock anomaly that the client does not control. No new identity is gained. What is lost is the enforcement of ticket expiration. Default builds contain this check; the trigger is the clock step, not a build option.
Affected Products and Versions
- Component:
src/internal.c,DoClientTicketCheck(), called for TLS 1.3 and DTLS 1.3 ticket resumption on the server. - Required build: TLS 1.3 with session tickets. With the non-default
WOLFSSL_32BIT_MILLI_TIME(src/tls.c:111), the millisecond clock wraps after about 49.7 days and produces the same negative age without a clock step. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- Default builds contain the check as described. In them the condition arises only after the server clock moves backwards.
- Other releases were not checked.
Technical Details
The first check, in the default 64-bit time branch (src/internal.c:43763-43771):
diff -= ticketSeen;
if (diff > timeout * 1000 ||
diff > (sword64)TLS13_MAX_TICKET_AGE * 1000)
return WOLFSSL_FATAL_ERROR;
Before this, diff is set to the current time in milliseconds. It is a signed 64-bit value. The test is an upper bound only, so a negative value passes. The WOLFSSL_32BIT_MILLI_TIME branch has the same test (src/internal.c:43749-43753).
The second check (src/internal.c:43773-43781) subtracts psk->ticketAge from diff, adds the ticket's ageAdd, and accepts a result from -1000 up to 1000 + MAX_TICKET_AGE_DIFF * 1000. How its two inputs reach it:
psk->ticketAgeis the 32-bitobfuscated_ticket_agefrom the ClientHellopre_shared_keyextension, stored as received (src/tls.c:12861). The binder proves possession of the ticket's secret. It does not constrain this field.ticketAddis theticket_age_addvalue the server sent to the client in the NewSessionTicket message (src/tls13.c:14482,src/tls13.c:14528).DoPreSharedKeys()calls the check atsrc/tls13.c:6851. The DTLS 1.3 path calls it atsrc/dtls.c:604.- With a negative age of
-dmilliseconds after the first check, the client sendsticketAdd - dminus a small margin as its claimed age. The final value is that margin, inside the window. This works whenticketAddis at least aboutd. A client that reports its real age is rejected here. The claimed age has to be chosen for the purpose. - On success
DoClientTicketFinalize()runs (src/tls13.c:6884),peerAuthGoodis set (src/tls13.c:6897) and, in early-data builds,maxEarlyDataSzis restored (src/tls13.c:6900). In default builds the fresh-start check that follows compares the ticket's timestamp with the context's start time, not with the current time (src/tls13.c:6933-6934). It does not bound the ticket's age.
Reachability and Preconditions
- A server resuming TLS 1.3 or DTLS 1.3 sessions from tickets.
- The server clock has stepped backwards far enough that the ticket's timestamp is ahead of it, or the build uses
WOLFSSL_32BIT_MILLI_TIMEand the millisecond clock has wrapped. The client cannot cause either. - The client holds a ticket the server issued and knows its
ticket_age_add, which every ticket holder does. That value is a 32-bit count of milliseconds, which limits how far ahead the timestamp can be. - The ticket's timestamp and
ageAddare protected by the ticket encryption. They cannot be forged, so only genuine tickets qualify.
Impact
A ticket is resumed after the configured timeout, and possibly after the seven-day maximum, by up to the size of the backward step. The connection is accepted as the ticket's identity. On a server that requires client certificates the resumption satisfies the client-authentication requirement, and 0-RTT early data is available again where it is enabled. The party that benefits is the ticket's legitimate holder. The loss is in what operators rely on expiration for: removing access after a set time and bounding the 0-RTT replay window.
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 add a lower bound to the first check, rejecting a negative age beyond a small tolerance for clock skew, and to bound the client's ticketAge before it is used. Tracking the clock wrap explicitly in WOLFSSL_32BIT_MILLI_TIME builds, and treating a detected backward step as invalidating outstanding tickets, would cover the remaining cases. Mitigation: keep ticket lifetimes short on systems that cannot guarantee a monotonic clock.
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.