Skip to content

[Bug]: SNI Missing Extension Alert Inconsistency #10318

@LiD0209

Description

@LiD0209

Contact Details

lxd_dong@bupt.edu.cn

Version

V5.9.1

Description

SNI Missing Extension Alert Inconsistency

Issue Overview

TLS 1.3 recommends a specific alert for the case where a server requires a
valid server_name extension, but the client's ClientHello does not contain
that extension.

In wolfSSL, the corresponding path aborts the handshake, but sends
handshake_failure rather than missing_extension.

This is therefore an alert-value inconsistency with the standard's recommended
behavior. It is not a case where wolfSSL completely fails to reject the invalid
scenario.

Standard Text

RFC 8446 Section 9.2, "Mandatory-to-Implement Extensions":
https://www.rfc-editor.org/rfc/rfc8446.html#section-9.2

Servers MAY require clients to send a valid "server_name" extension.
Servers requiring this extension SHOULD respond to a ClientHello
lacking a "server_name" extension by terminating the connection with
a "missing_extension" alert.

Key point: this is a SHOULD, not a MUST.

wolfSSL Code Behavior

The key code is in tls.c:

if (ctx_sni->options & WOLFSSL_SNI_ABORT_ON_ABSENCE) {
    sni = TLSX_SNI_Find(ssl_sni, ctx_sni->type);

    if (sni) {
        if (sni->status != WOLFSSL_SNI_NO_MATCH)
            continue;

        /* if ssl level overrides ctx level, it is ok. */
        if ((sni->options & WOLFSSL_SNI_ABORT_ON_ABSENCE) == 0)
            continue;
    }

    SendAlert(ssl, alert_fatal, handshake_failure);
    WOLFSSL_ERROR_VERBOSE(SNI_ABSENT_ERROR);
    return SNI_ABSENT_ERROR;
}

The same logic also appears on the SSL-level path; see
tls.c.

Standard vs. wolfSSL

Standard behavior:

  • Condition: the server requires server_name.
  • Client behavior: ClientHello lacks server_name.
  • Recommended alert: missing_extension.

wolfSSL behavior:

  • Condition: WOLFSSL_SNI_ABORT_ON_ABSENCE is enabled.
  • Client behavior: ClientHello lacks server_name.
  • Actual alert: handshake_failure.

Conclusion

wolfSSL does reject the missing-SNI case when configured to abort on SNI
absence, but it uses handshake_failure instead of the RFC 8446 recommended
missing_extension alert.

Classification: partially aligned with the standard's intent, but inconsistent
with the recommended alert value.

Reproduction steps

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions