]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] crypto/tls: reject trailing messages after client/server...
authorRoland Shoemaker <roland@golang.org>
Mon, 24 Nov 2025 22:03:10 +0000 (14:03 -0800)
committerJunyang Shao <shaojunyang@google.com>
Wed, 7 Jan 2026 21:28:54 +0000 (13:28 -0800)
commitad2cd043db66cd36e1f55359638729d2c8ff3d99
tree0f4450d050d5585de12d9d70bc66ec09abe73e7d
parent27dc6f01ffe70179b90d6c660d67d29967fa2eef
[release-branch.go1.24] crypto/tls: reject trailing messages after client/server hello

For TLS 1.3, after procesesing the server/client hello, if there isn't a
CCS message, reject the trailing messages which were appended to the
hello messages. This prevents an on-path attacker from injecting
plaintext messages into the handshake.

Additionally, check that we don't have any buffered messages before we
switch the read traffic secret regardless, since any buffered messages
would have been under an old key which is no longer appropriate.

We also invert the ordering of setting the read/write secrets so that if
we fail when changing the read secret we send the alert using the
correct write secret.

Updates #76443
Fixes #76854
Fixes CVE-2025-61730

Change-Id: If6ba8ad16f48d5cd5db5574824062ad4244a5b52
Reviewed-on: https://go-review.googlesource.com/c/go/+/724120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Coia Prant <coiaprant@gmail.com>
(cherry picked from commit 5046bdf8a612b35a2c1a9e168054c1d5c65e7dd7)
Reviewed-on: https://go-review.googlesource.com/c/go/+/731961
Reviewed-by: Damien Neil <dneil@google.com>
src/crypto/tls/conn.go
src/crypto/tls/handshake_client_tls13.go
src/crypto/tls/handshake_server_tls13.go
src/crypto/tls/handshake_test.go
src/crypto/tls/quic.go