mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-27 09:28:06 +03:00
crypto/tls: do not count handshake messages as state-advancing post-handshake
Previously, we always counted handshake messages, such as KeyUpdate, as state-advancing, regardless of whether a handshake has been completed or not. As a result, a malicious client can keep sending KeyUpdate messages to force the server to keep performing key derivation operations indefinitely. Fix the issue by making it so that handshake messages are regarded as state-advancing only prior to handshake completion. Thank you to Qi Deng of Aurascape.ai for reporting this issue. Fixes #79866 Fixes #80528 Fixes CVE-2026-56862 Change-Id: I37d27fd5f16227a9dde5f29bb5ae6c436a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/804261 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Neal Patel <nealpatel@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Neal Patel <neal@golang.org>
This commit is contained in:
@@ -732,7 +732,7 @@ func (c *Conn) readRecordOrCCS(expectChangeCipherSpec bool) error {
|
||||
return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage))
|
||||
}
|
||||
|
||||
if typ != recordTypeAlert && typ != recordTypeChangeCipherSpec && len(data) > 0 {
|
||||
if (typ == recordTypeApplicationData || (typ == recordTypeHandshake && !handshakeComplete)) && len(data) > 0 {
|
||||
// This is a state-advancing message: reset the retry count.
|
||||
c.retryCount = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user