Skip to content

ForceZero session ticket fields before freeing - #12250

Draft
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:f7575
Draft

rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:f7575

Conversation

@rlm2002

@rlm2002 rlm2002 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Description

wolfSSL_FreeSession and EvictSessionFromCache freed the session ticket and the TLS 1.3 ticket nonce without wiping them, unlike masterSecret and sessionID. Both functions now:

  • Wipe an allocated ticket over its full ticketLenAlloc before XFREE.
  • Wipe an allocated ticket nonce before XFREE.
  • Always wipe staticTicket.

Fixes F-7575 and F-7562

Testing

./configure --enable-session-ticket && make check
./configure --enable-session-ticket --disable-ticket-nonce-malloc && make check

@rlm2002 rlm2002 self-assigned this Nov 24, 2026
Copilot AI balanced review requested due to automatic review settings November 24, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A long-nonce allocation failure leaves a NULL data pointer with a nonzero length, causing cleanup to write through NULL instead of returning the decoding failure.

1 open issue
What changed in this PR

This PR strengthens wolfSSL session cleanup by wiping ticket data before freeing or reusing its storage, addressing F-7575 and F-7562.

Changes:

  • Wipe dynamically allocated tickets and TLS 1.3 ticket nonces before freeing them.
  • Clear static ticket buffers and static nonce storage during session cleanup.
  • Replace the cache-eviction session ID clear with ForceZero.
File Description
src/​ssl_sess.c Adds secure wiping to session destruction and cache eviction.

Review effort: Balanced

Comment thread src/ssl_sess.c Resolved
Wipe ticket and nonce buffers in wolfSSL_FreeSession and the other
session free paths. Reset the nonce to the static buffer when its
allocation fails so the wipe never writes through NULL. Add a test.

Fixes F-7575.
Clear the ticket, nonce and their lengths in evicted and overwritten
cache rows so saved caches no longer hold them. Add a test.

Fixes F-7562.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants