← ALL ADVISORIES

LOW BYTERAY-2026-0454Disclosed

wolfSSL — Missing Fatal Alert for Unmapped Errors in DTLS Stateless ClientHello Handling

When the DTLS stateless cookie exchange fails, DoClientHello asks TranslateErrorToAlert for an alert and sends one only if the error code is in that function's list. Codes outside the list, such as MEMORY_E, end the handshake with no alert to the client.

Advisory
BYTERAY-2026-0454
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), DTLS servers (WOLFSSL_DTLS) processing a ClientHello through the stateless cookie exchange
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

A wolfSSL DTLS server handles a client's first ClientHello without keeping state. DoClientHello() calls DoClientHelloStateless(), which checks or issues a cookie. If that step fails, DoClientHello() converts the error code to a TLS alert with TranslateErrorToAlert() and sends it.

TranslateErrorToAlert() covers a fixed list of error codes. For every other code it returns invalid_alert, and DoClientHello() sends an alert only when the result is not invalid_alert. Failures such as an allocation error while building the cookie reply fall outside the list. The server resets its state and sends nothing.

The client learns of the failure only when its retransmissions go unanswered. No data is exposed. A silent drop is partly normal for a stateless cookie exchange, so the practical effect is a small gap in conformance and diagnosability under failure conditions. DTLS is not enabled in a default build.

Affected Products and Versions

  • Component: src/internal.c, DoClientHello(), the DTLS stateless branch, together with TranslateErrorToAlert() in the same file.
  • Required build: DTLS support (WOLFSSL_DTLS, --enable-dtls). The gap does not depend on WOLFSSL_EXTRA_ALERTS.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default ./configure build does not enable DTLS (configure.ac:2640-2644). Other releases were not checked.

Technical Details

The stateless branch is at src/internal.c:41838-41858:

            ret = DoClientHelloStateless(ssl, input + *inOutIdx, helloSz, 0,
                    NULL);
            if (ret != 0 || !ssl->options.dtlsStateful) {
                int alertType = TranslateErrorToAlert(ret);
                if (alertType != invalid_alert) {
                    int err;

                    /* propagate socket errors to avoid re-calling send alert */
                    err = SendAlert(ssl, alert_fatal, alertType);

TranslateErrorToAlert() (src/internal.c:39167-39209) ends with default: return invalid_alert; at src/internal.c:39206-39207. The comment above its first case (src/internal.c:39170-39175) notes that a code missing from the list means the handshake aborts with no alert sent.

  1. A DTLS client sends a ClientHello. The server is not yet stateful for that peer, so DoClientHello() calls DoClientHelloStateless() (src/dtls.c:1027).
  2. The stateless step fails with a code that the mapper does not list. The sources are MEMORY_E from allocations on the cookie path (src/dtls.c:1063-1071, src/dtls.c:1104-1106), a failure in SendStatelessReply() (src/dtls.c:1100, src/dtls.c:1121), or a parser error passed through from ParseClientHello() (src/dtls.c:1050-1052).
  3. TranslateErrorToAlert() returns invalid_alert. The guard at src/internal.c:41845 skips SendAlert().
  4. DtlsResetState() runs. DtlsIgnoreError() turns some codes into success, and the rest are returned to the application (src/internal.c:41853-41857).

The mapper's default case is the subject of BYTERAY-2026-0465, and the TLS 1.3 ServerHello consumer is described in BYTERAY-2026-0458. This advisory covers the DTLS consumer, which has no fallback alert of its own.

Reachability and Preconditions

  • Build with DTLS support. wolfSSL acts as a DTLS server. The ClientHello is handled by the stateless cookie exchange, which is the case for a peer that has not yet returned a valid cookie.
  • The attacker is a remote client and needs no authentication. It controls the ClientHello bytes.
  • The unmapped errors on this path are environmental: memory exhaustion while building the cookie or the reply, or a socket write failure. A client can add load, but it cannot produce them at will.

Impact

Under those failure conditions the handshake ends before authentication and the client receives no alert. It finds out through a retransmission timeout. The effect is on conformance and diagnostics, with a minor availability aspect for the client that is waiting. Dropping unauthenticated input without a reply is a defensible choice on this path. The code does not make that choice explicitly, and the outcome depends on which error codes the mapper happens to list. Confidentiality and integrity are not affected.

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 close the gap in TranslateErrorToAlert(): map resource and internal failures to internal_error and list the remaining codes that DoClientHelloStateless() can return. As a second layer, consumers of the mapper can send a default fatal alert when it returns invalid_alert. If a silent drop is the intended policy for the stateless path, it should be coded as an explicit early drop so that it is deliberate and documented. No configuration workaround is known.

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