New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto/tls: client requires HelloRetryRequest to change curve #30149

Open
sergeyfrolov opened this Issue Feb 10, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@sergeyfrolov
Copy link
Contributor

sergeyfrolov commented Feb 10, 2019

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.

@FiloSottile FiloSottile self-assigned this Feb 11, 2019

@FiloSottile FiloSottile added this to the Go1.13 milestone Feb 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment