-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
What version of Go are you using (go version
)?
master @ ca7c12d
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/user/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/user/go" GOPROXY="" GORACE="" GOROOT="/home/user/opt/go" GOTMPDIR="" GOTOOLDIR="/home/user/opt/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build262703332=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Read the source code.
What did you expect to see?
HelloRetryRequest may be sent to the client for a range of reasons, for example, to set TLS 1.3 "Cookie" extension and "demonstrate reachability at their apparent network address (thus providing a measure of DoS protection)". Client is expected to handle this case correctly.
What did you see instead?
Client has following checks:
curveID := hs.serverHello.selectedGroup
if curveID == 0 {
c.sendAlert(alertMissingExtension)
return errors.New("tls: received HelloRetryRequest without selected group")
}
and
if hs.ecdheParams.CurveID() == curveID {
c.sendAlert(alertIllegalParameter)
return errors.New("tls: server sent an unnecessary HelloRetryRequest message")
}
which essentially require HelloRetryRequest to switch curve ID. However, as mentioned above, there are other use-cases for that complicated HelloRetryRequest.
Cookie seems to be correctly added to the follow-up ClientHello, if curve changes as well.
I am not aware of any servers on the internet that actually send HelloRetryRequest for any reason other than to switch curve in Key Share (are there any such servers?), so not sure if there's any real-world impact.