← ALL ADVISORIES

LOW BYTERAY-2026-0467Disclosed

wolfSSL — Missing Error Code Store in TLS 1.3 Server Client-Authentication Fail-Safe

The client-authentication fail-safe in wolfSSL_accept_TLSv13 returns WOLFSSL_FATAL_ERROR without storing a cause in ssl->error. wolfSSL_get_error then returns a leftover value, zero or a stale WANT_READ or WANT_WRITE, so an application can misread a fatal authentication failure.

Advisory
BYTERAY-2026-0467
CWE
CWE-544
CVSS
3.7 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L)
Vendor
wolfSSL
Product
wolfSSL
Reported
2026-09-28
Disclosure
2026-12-03
Affected
wolfSSL 5.9.2 (tested at master commit d95483f), all builds with TLS 1.3; TLS 1.3 servers that require client authentication
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

In the last stage of the TLS 1.3 server handshake, wolfSSL_accept_TLSv13() checks that the client was authenticated. If ssl->options.peerAuthGood was never set, the function stops and returns WOLFSSL_FATAL_ERROR.

That return is not preceded by a write to ssl->error. The other failure paths in the same function store an error code first, and the client-side counterpart in the TLS 1.2 driver stores NO_PEER_VERIFY. wolfSSL_get_error() hands the slot back to the caller, so after this branch the application sees zero on a reused object, or a WANT_READ or WANT_WRITE left from an earlier non-blocking round.

The handshake still fails, so this is not an authentication bypass. An application that follows the documented retry contract can treat the failure as "no error" or keep retrying an accept that cannot succeed. The missing store is present in every TLS 1.3 build, default builds included. Reaching the branch needs an uncommon server configuration.

Affected Products and Versions

  • Component: src/tls13.c, wolfSSL_accept_TLSv13(), the final peer authentication check.
  • Required build: TLS 1.3 support. No other option is needed.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default ./configure build contains the branch. It is reached only on servers that require client authentication, in the conditions listed below.
  • Other releases were not checked.

Technical Details

The check at src/tls13.c:18221-18224:

            if (!ssl->options.peerAuthGood) {
                WOLFSSL_MSG("Client authentication did not happen");
                return WOLFSSL_FATAL_ERROR;
            }

Other failure paths in the same function assign ssl->error before they return: the key derivation failure (src/tls13.c:18198-18201), the session ticket send failure (src/tls13.c:18229-18231) and the handshake-done callback failure (src/tls13.c:18250-18253). The client-side fail-safe in the TLS 1.2 driver stores NO_PEER_VERIFY (src/ssl_api_hs.c:635-638).

What the application then sees:

  1. wolfSSL_accept_TLSv13() returns WOLFSSL_FATAL_ERROR from the check with ssl->error untouched.
  2. The application calls wolfSSL_get_error().
  3. wolfSSL_get_error() converts WANT_READ, WANT_WRITE and ZERO_RETURN and otherwise returns ssl->error as it is (src/ssl.c:1684-1701).
  4. The slot holds 0 if an earlier handshake on the same object succeeded, because success clears it (src/ssl_api_hs.c:1166). Otherwise it can hold WANT_READ or WANT_WRITE from an earlier non-blocking call.
  5. The application reads "no error" or "retry" for a failure that is final.

Reachability and Preconditions

  • Build with TLS 1.3. No other flag is required.
  • The server requires client authentication.
  • The failure has to surface at this final check. A missing or empty client Certificate message is detected earlier in the handshake, and that path stores ssl->error correctly. The final check is reached only in configurations that leave peerAuthGood unset at the end, such as resumption edge cases.
  • The application decides what to do from wolfSSL_get_error(), as event-loop and retry-style code does.
  • The attacker is a remote client. No authentication is needed.

Impact

An application can misclassify a fatal client-authentication failure. It may handle the failure as "no error", or it may call wolfSSL_accept() again and loop on a state machine that can no longer succeed. The effect is on reliability and error reporting. The connection is still terminated and the peer is rejected. There is no authentication bypass.

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 store a defined cause in ssl->error, for example NO_PEER_VERIFY, immediately before the return in this check, as the neighboring paths and the client-side fail-safe do. The other last-resort and unknown-state exits of the accept state machines should be reviewed so that every fatal return leaves a retrievable cause. Application-side mitigation: treat WOLFSSL_FATAL_ERROR from wolfSSL_accept() as final when wolfSSL_get_error() returns zero, and bound the number of handshake retries.

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