wolfSSL — Missing Fatal Alert for Unmapped Error Codes in TLS 1.3 TranslateErrorToAlert
TranslateErrorToAlert maps a fixed list of error codes to TLS 1.3 alerts and returns invalid_alert for all others. The handshake dispatcher sends no alert for that value, so errors such as MEMORY_E, SIDE_ERROR and VERIFY_FINISHED_ERROR end a TLS 1.3 handshake without an alert.
- Advisory
- BYTERAY-2026-0465
- 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, which includes the default configuration
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
When a TLS 1.3 handshake message handler fails, DoTls13HandShakeMsgType() asks TranslateErrorToAlert() which fatal alert matches the error code and sends it. RFC 8446 section 6 expects an alert for every fatal handshake failure, with internal_error for failures that have no more specific alert.
TranslateErrorToAlert() lists a fixed set of error codes. Its default: branch returns the placeholder invalid_alert, and the caller treats that value as "send nothing". Any error code that is not in the list ends the connection without an alert. A comment in the function describes this exact effect for two buffer error codes, which are mapped; the default: branch is unchanged.
The connection fails either way. What is lost is the peer-visible reason. The TLS 1.2 mapper falls back to handshake_failure, so the two protocol versions also behave differently for the same error. The mapper is not behind a build option, so default TLS 1.3 builds are affected.
Affected Products and Versions
- Component:
src/internal.c,TranslateErrorToAlert(); its callerDoTls13HandShakeMsgType()insrc/tls13.c. - Required build: TLS 1.3 support. No other option is needed.
- Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default
./configurebuild is affected. - Other releases were not checked.
Technical Details
The end of the switch in TranslateErrorToAlert() at src/internal.c:39203-39207:
case WC_NO_ERR_TRACE(OUT_OF_ORDER_E):
case WC_NO_ERR_TRACE(DUPLICATE_MSG_E):
return unexpected_message;
default:
return invalid_alert;
The flow for an unmapped code:
- A TLS 1.3 handshake message handler returns an error that is not in the list. Examples are
MEMORY_Efrom a failed allocation while a peer-supplied message is parsed,SIDE_ERRORfrom a message sent by the wrong side,VERIFY_FINISHED_ERROR, and most wolfCrypt error codes. DoTls13HandShakeMsgType()computesalertType = TranslateErrorToAlert(ret)(src/tls13.c:16151).- The
default:branch returnsinvalid_alert(src/internal.c:39206-39207). - The caller sends an alert only when
alertType != invalid_alert(src/tls13.c:16160-16171), soSendAlert()is skipped. - The error is returned,
ssl->erroris set by the accept or read path, and the connection is closed with nothing sent.
The comment at src/internal.c:39170-39175 says that unless BUFFER_ERROR and BUFFER_E are mapped, "the handshake aborts silently with no alert sent". The same holds for every code that reaches default:. For comparison, the TLS 1.2 mapper SendFatalAlertOnly() ends with default: why = handshake_failure; (src/internal.c:21181-21182) when it is compiled in.
Reachability and Preconditions
- Build with TLS 1.3. No other flag is required.
- A TLS 1.3 or DTLS 1.3 endpoint reachable over the network.
- The attacker is a remote peer that sends a handshake message whose processing fails with an unmapped code.
SIDE_ERRORdepends only on which message the peer sends.MEMORY_Edepends on host memory pressure, which the peer can increase with large extension or key share sets but does not control. - No authentication is needed.
Impact
A TLS 1.3 handshake that fails with an unmapped error code is closed without the fatal alert RFC 8446 section 6 calls for. The peer sees a truncated connection or a timeout; a DTLS peer retransmits until it times out. Diagnosis is harder, interoperability suffers, and the missing alert distinguishes the implementation from others. There is no code execution and no authentication bypass. The connection is closed in every case.
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 for the default: branch of TranslateErrorToAlert() to return a real fatal alert, internal_error for unexpected internal failures, while the specific mappings stay as they are. As a second layer, DoTls13HandShakeMsgType() can treat invalid_alert as internal_error, with a separate flag for the cases where an alert must not be sent because one already went out. The TLS 1.3 and TLS 1.2 fallbacks should be aligned or the difference documented. There is no configuration workaround.
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.