← ALL ADVISORIES

LOW BYTERAY-2026-0477Disclosed

wolfSSL — Unchecked Record Cursor Advance at Server Early-Data Exits in DoProcessReplyEx

Two server-side early-data exits in DoProcessReplyEx add the record padding size to the shared input cursor and return success without comparing the cursor to the buffered length. Every current server-side TLS 1.3 handler consumes its message exactly, so this is a missing check and not a reachable out-of-bounds access.

Advisory
BYTERAY-2026-0477
CWE
CWE-125
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), TLS 1.3 and DTLS 1.3 servers in builds with WOLFSSL_EARLY_DATA (--enable-earlydata); no out-of-bounds state is reachable through these exits in the tested tree
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

DoProcessReplyEx() is the record receive loop. It tracks consumption of the input buffer with one shared cursor, ssl->buffers.inputBuffer.idx. When a TLS 1.3 server finishes a handshake message while it is still reading client early data, the loop takes an early exit: it adds ssl->keys.padSz to the cursor to skip the record padding and returns APP_DATA_READY.

There are two such exits, one on the DTLS 1.3 path and one on the stream TLS 1.3 path. Neither compares the cursor with the end of the buffered data before it returns. The next pass through the loop trusts the cursor it is given.

This cannot be turned into an out-of-bounds access in the tested tree. Both exits are server-only, and every server-side TLS 1.3 handler consumes its message exactly, so the cursor lands on the record end. The issue is a missing check at a place where other advances on the same path are checked. Early data is not part of a default build.

Affected Products and Versions

  • Component: src/internal.c, DoProcessReplyEx(), the handshake case of the record loop.
  • Required build: TLS 1.3 with WOLFSSL_EARLY_DATA (--enable-earlydata). The DTLS exit also needs WOLFSSL_DTLS13.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default ./configure build does not compile these exits. Early data is disabled by default.
  • Other releases were not checked.

Technical Details

The DTLS 1.3 exit follows Dtls13HandshakeRecv() (src/internal.c:26239-26242). The gate at src/internal.c:26244-26247 requires the server side, pending early data and HANDSHAKE_DONE. The exit is at src/internal.c:26253-26257:

                                    if (IsEncryptionOn(ssl, 0))
                                        ssl->buffers.inputBuffer.idx +=
                                            ssl->keys.padSz;
                                    return APP_DATA_READY;

The stream TLS 1.3 exit has the same shape after DoTls13HandShakeMsg() (src/internal.c:26350-26359). padSz is the stripped record padding: the content-type byte, the zero padding chosen by the sender, and the AEAD tag. In both exits the cursor moves by that amount and the function returns with no comparison against inputBuffer.length.

Other advances on this path are checked. The DTLS window-drop advance returns BUFFER_E when idx > length (src/internal.c:26125-26130). The record-done advance is followed by an idx >= length test (src/internal.c:26444-26450). The two early-data exits are the only success returns that rely entirely on the handler having consumed the record exactly.

Data flow:

  1. A client record is consumed through the live cursor by Dtls13HandshakeRecv() or DoTls13HandShakeMsg().
  2. The server-side, early-data and handshake-state gate passes, and processReply is reset to doProcessInit.
  3. The exit adds padSz to the cursor and returns APP_DATA_READY.
  4. The next doProcessInit pass starts from that cursor (src/internal.c:25680-25695). In the tested tree step 3 always leaves the cursor on the record end. The one handler branch known to over-advance the cursor, described in BYTERAY-2026-0315, runs only on the client and cannot reach these server-only exits.

Reachability and Preconditions

  • Build with TLS 1.3 and WOLFSSL_EARLY_DATA; server role; the client sent early data.
  • The peer is a remote TLS client. No authentication is needed to reach the exits.
  • An invalid cursor at these exits needs a server-side TLS 1.3 handler that over-advances the cursor. No such handler exists in the tested tree.

Impact

None on its own in the tested tree. If a server-side handler over-advanced the cursor, these exits would pass the invalid cursor on with a success return. The result would be at least a failed connection, and on DTLS the cursor would enter the same propagation path as BYTERAY-2026-0315. A fix applied only at the record-done advance would leave these two sites unguarded.

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 check the cursor immediately after the padding advance at both exits and return BUFFER_E when idx > length, as the window-drop path already does. Requiring the cursor to equal the record end is stronger. A single shared check after the handshake handlers return would cover every padSz advance site at once. No configuration change is needed for current builds. Builds without WOLFSSL_EARLY_DATA do not contain the exits.

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