← ALL ADVISORIES

LOW BYTERAY-2026-0469Disclosed

wolfSSL — Unscoped Server-Authentication Grant in TLS 1.2 Client Session Resumption

On a resumed TLS 1.2 handshake the wolfSSL client marks the server as authenticated as soon as it has copied the cached master secret. The session records nothing about whether the server certificate was verified when it was created, so a session made without verification resumes on a connection that requires it.

Advisory
BYTERAY-2026-0469
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 clients that resume a session created or imported under a weaker verification policy (default builds)
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

When a server echoes a cached session ID in its ServerHello, the wolfSSL client takes the abbreviated TLS 1.2 handshake. CompleteServerHello() in src/internal.c copies the stored master secret, derives keys, and sets ssl->options.peerAuthGood. No Certificate message is processed on this path.

peerAuthGood is the flag the client's fail-safe tests before it finishes the handshake. WOLFSSL_SESSION has no field that says whether the server's certificate was verified in the original handshake, and the resume path does not compare the session's history with the current verification policy. A session created with verification disabled or failed, or moved into a client that now requires verification, resumes with the flag already set. wolfSSL_get_verify_result() then reports success, because that result is only written during certificate processing.

This is not a plain network attack. The party driving the resumed handshake must produce a Finished message under the session's master secret. For ordinary resumption with the original server the behaviour matches the TLS 1.2 abbreviated handshake and other TLS implementations. The gap is the missing policy check when a session crosses verification contexts. Default builds contain this code.

Affected Products and Versions

  • Component: src/internal.c, CompleteServerHello(), the client-side TLS 1.2 resumption branch.
  • Required build: a TLS client with TLS 1.2 session resumption, which is the default.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • Default builds are affected.
  • Other releases were not checked.

Technical Details

The grant is at src/internal.c:35632, in the branch taken when DSH_CheckSessionId() reports a resumable session ID (src/internal.c:35607):

                    /* SERVER: peer auth based on session secret. */
                    ssl->options.peerAuthGood = (ret == 0);
                    ssl->options.serverState = SERVER_HELLODONE_COMPLETE;

The comment says "SERVER" although this code runs on the client. The same comment and assignment appear at the server-side grants (src/internal.c:41648, src/internal.c:41804).

  1. The server's ServerHello echoes a session ID the client holds. DSH_CheckSessionId() checks possession only.
  2. The client copies the master secret from the cached session (src/internal.c:35618-35619) and derives the connection keys.
  3. peerAuthGood is set from the key derivation result alone. WOLFSSL_SESSION (wolfssl/internal.h:5086-5145) stores no server-authentication outcome that could be consulted.
  4. wolfSSL_connect() reaches its fail-safe in the FIRST_REPLY_SECOND state (src/ssl_api_hs.c:635-639). It would abort with NO_PEER_VERIFY if the flag were clear. On a resumed handshake the grant above is the only thing that satisfies it.
  5. The handshake completes after the Finished exchange. DoFinished() compares the peer's Finished against the value computed under the master secret (src/internal.c:19919-19925), so a party without that secret fails here.

The only related control is the session-context check in src/ssl_sess.c:1614-1621, which applies only when the application sets a session context.

Reachability and Preconditions

  • Build: default client build with TLS 1.2.
  • Runtime: the client holds a session that was created while verification was disabled or had failed, or that was imported with wolfSSL_set_session() into a client whose current policy requires peer verification.
  • Attacker position: the server side of the resumed handshake, with knowledge of that session's master secret. In practice this is the server that created the session, or a holder of exported or stolen session state.
  • An attacker on the network without the master secret cannot complete the handshake.

Impact

A connection configured to verify the server completes without any certificate verification, and the API reports the verification result as success. A holder of the session's master secret is accepted as the server without the server's private key, and the client sends application data to it. The realistic case is session state carried between security contexts with different verification rules, or a server that created sessions under a weak policy. This is a hardening gap in how the resumption grant is scoped. It is not a remote verification bypass for an arbitrary attacker.

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 record the server-authentication outcome in WOLFSSL_SESSION and in the session export format when the session is created, and to set peerAuthGood on resumption only when that stored state satisfies the current connection's verification policy. Otherwise the client should fall back to a full handshake. Binding sessions to their security context by default would close the import case. The "SERVER" comment at the grant should be corrected.

Workaround: do not resume sessions that were created under a weaker verification policy, and do not move sessions between client contexts with different policies. Setting a session context on each client context enables the existing context check.

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