]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.25] 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:52 +0000 (13:28 -0800)
commit525dd853633f90d6038719d9a48cba3770ca71ea
tree55ca19e23faf382b345ce431226885f16f158880
parentddcf27fc8c8af1be6304dbe772b76fcdd70d4099
[release-branch.go1.25] 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 #76855
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/+/731960
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