wolfSSL — Missing Fatal Alert for Unmapped TLS 1.3 ServerHello Errors in DoServerHello
When DoTls13ServerHello fails, DoServerHello sends a fatal alert only if TranslateErrorToAlert knows the error code. For codes outside its list, such as MEMORY_E, it returns invalid_alert and the client closes the connection without sending any alert.
- Advisory
- BYTERAY-2026-0458
- 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), TLS 1.3 clients, including the default configuration
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
A wolfSSL client that offers TLS 1.3 receives the ServerHello through the common handshake dispatcher. DoServerHello() detects the TLS 1.3 version and hands the message to DoTls13ServerHello(). If that fails, DoServerHello() converts the error code to an alert with TranslateErrorToAlert() and sends it.
TranslateErrorToAlert() lists a fixed set of error codes. Its default case returns invalid_alert, and DoServerHello() treats that value as "send nothing". An error outside the list, for example an allocation failure while the ServerHello extensions are processed, ends the handshake with no alert. RFC 8446 section 6 expects a fatal alert, at minimum internal_error.
The connection is abandoned either way. The server sees a close or a timeout with no TLS-level reason. Default builds are affected.
Affected Products and Versions
- Component:
src/internal.c,DoServerHello(), the TLS 1.3 branch, together withTranslateErrorToAlert()in the same file. - Required build: TLS 1.3 support (
WOLFSSL_TLS13) and the client role. The gap does not depend onWOLFSSL_EXTRA_ALERTS. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default
./configurebuild is affected. Other releases were not checked.
Technical Details
The TLS 1.3 branch is at src/internal.c:35302-35315. After the call to DoTls13ServerHello() it reads:
if (ret != 0 &&
ssl->alert_history.last_tx.level != alert_fatal) {
int alertType = TranslateErrorToAlert(ret);
if (alertType != invalid_alert) {
if (SendAlert(ssl, alert_fatal, alertType) ==
WC_NO_ERR_TRACE(SOCKET_ERROR_E))
ret = SOCKET_ERROR_E;
}
}
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. MEMORY_E, SIDE_ERROR and internal crypto error codes are not in the list.
- The client sends a ClientHello. The server replies with a ServerHello that selects TLS 1.3.
DoServerHello()callsDoTls13ServerHello()atsrc/internal.c:35304. Processing fails with a code that the mapper does not list.TranslateErrorToAlert()returnsinvalid_alert. The guard atsrc/internal.c:35308skipsSendAlert().DoServerHello()returns the error and the client closes the connection.
The branch has a second condition. It sends nothing when ssl->alert_history.last_tx already records a fatal alert (src/internal.c:35305-35306). That record is written when an alert is queued, so the guard depends on history and not on confirmed delivery. The alert history is described in BYTERAY-2026-0463. The same guard shape exists in the TLS 1.3 message dispatcher (src/tls13.c:16160-16171). The mapper's default case is the subject of BYTERAY-2026-0465. This advisory covers the DoServerHello() consumer.
Reachability and Preconditions
- wolfSSL acts as a TLS 1.3 client.
- The attacker is the server, or a party on the path who can alter the ServerHello, which is sent in plaintext. No authentication has taken place at this point in the handshake.
- The attacker must make
DoTls13ServerHello()fail with an unlisted code. The realistic case isMEMORY_Eunder allocation pressure while the ServerHello is processed. That depends on the client's resources and timing. Malformed input that produces a listed code, such asBUFFER_ERROR, does get an alert.
Impact
Once an unlisted error occurs, the handshake ends without the fatal alert. The peer and any monitoring see a truncation or a timeout, which looks the same as a network outage. The connection fails in both cases, so the effect is the missing failure signal: reduced diagnosability and a deviation from the alert behavior TLS 1.3 requires. Authentication is not bypassed and no data is exposed.
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 make TranslateErrorToAlert() return a valid fatal alert for unlisted codes, internal_error for TLS 1.3, while keeping the specific mappings. As a second layer, DoServerHello() and the parallel consumer in src/tls13.c can send internal_error themselves when the mapper returns invalid_alert. The history guard should suppress an alert only when an earlier fatal alert was actually delivered. No configuration workaround is known. WOLFSSL_EXTRA_ALERTS does not affect this path.
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.