Skip to content

crypto/tls: do not enforce legacy_record_version while reading TLS 1.3 records #67910

@avened

Description

@avened

Go version

go version go1.21.6 linux/amd64

Output of go env in your module/workspace:

[...]

What did you do?

Called crypto/tls tls.Client() to connect to particular TLS server with TLS 1.3.

What did you see happen?

Error: "tls: received record with version 301 when expecting version 303".

What did you expect to see?

Successful connection, no error.

I believe this is a side effect of TLS version field enforcement while reading TLS records. See these particular lines in conn.go:

if expectedVers == VersionTLS13 {

and

if c.haveVers && vers != expectedVers {

Although legacy_record_version must indeed be set to 0x0303, - as by RFC 8446 Section 5.1, - "for all records generated by a TLS 1.3 implementation other than an initial ClientHello", the very same paragraph of RFC 8446 clearly requires to otherwise ignore the legacy_record_version value, as "[t]his field is deprecated". It seems that client reading TLS records for TLS 1.3 should tolerate "wrong value" discovered in record header, possibly by completely ignoring it. And this was the exact case before version enforcement, thus enabling successful TLS 1.3 connections to some "buggy" servers, which is no longer possible with newer crypto/tls. Please, consider reverting to former version-tolerant variant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions