Skip to content

Send unexpected message alert for UNKNOWN_RECORD_TYPE - #11289

Open
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:fenrir
Open

Send unexpected message alert for UNKNOWN_RECORD_TYPE#11289
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:fenrir

Conversation

@rlm2002

@rlm2002 rlm2002 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

DoProcessReplyEx() rejected records with an undefined ContentType but returned UNKNOWN_RECORD_TYPE without putting an alert on the wire. RFC 8446 section 5 and RFC 9846 section 5 both require that a TLS implementation receiving an unexpected record type MUST terminate the connection with an unexpected_message alert. RFC 5246 section 6 states the same for TLS 1.2.

Two rejection sites were affected:

  1. The error mapping switch in case getRecordLayerHeader, which handled VERSION_ERROR and LENGTH_ERROR, but let UNKNOWN_RECORD_TYPE fall through to default: break.
  2. The record dispatch default: arm, reached by types the whitelist admits but nothing on a TLS connection handles. dtls12_cid (25) and ack (26) pass the header check whenever WOLFSSL_DTLS_CID or WOLFSSL_DTLS13 are built, with no ssl->options.dtls guard. It is also reached with the inner ContentType recovered by removeMsgInnerPadding().

Both now send a fatal unexpected_message before returning.

Fixes F-10722

Testing

Added new unit test: test_tls_unknown_record_type_alert
./configure --enable-all && make check

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@rlm2002 rlm2002 self-assigned this Aug 26, 2026
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

@rlm2002

rlm2002 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Retest this please Jenkins: history lost

@night1rider

Copy link
Copy Markdown
Contributor

Jenkins retest this please

@rlm2002

rlm2002 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Retest this please Jenkins

Send fatal unexpected_message alert ssl->when curRL.type is UNKNOWN_RECORD_TYPE when not using DTLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants