Skip to content

crypto/tls: TLS1.3 occasionally fails with "tls: error decoding message" when fetching from https://tls13.1d.pw #41983

@firefart

Description

@firefart

What version of Go are you using (go version)?

$ go version
go version go1.15.2 linux/amd64

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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/firefart/.cache/go-build"
GOENV="/home/firefart/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/firefart/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/firefart/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
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-build097380316=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Hi,
we've noticed something strange when testing a tool against a TLS1.3 only test server over at https://tls13.1d.pw/ . Requests to this server sometimes succeed and sometimes return a remote error: tls: error decoding message error.
From here it looks like the webserver used on this testing site is a custom implementation (the Server header indicates Server: Z/pZ v.1.11.beta) so I think this might be a server side issue on their side, but by using various browsers this issue can not be reproduced (maybe they are less strict on handling the TLS1.3 protocol).
So I'm opening an issue here so someone familiar with TLS1.3 might have a look at this to rule out a possible golang error on handling or sending TLS1.3 packets.

Thanks!

Test script:

package main

import (
        "net/http"
        "log"
        "io/ioutil"
)

func main() {
        resp, err := http.Get("https://tls13.1d.pw/")
        if err != nil {
                log.Fatalln(err)
        }

        body, err := ioutil.ReadAll(resp.Body)
        if err != nil {
                log.Fatalln(err)
        }

  log.Println("Success")
  _ = body
  // log.Println(string(body))
}

Example run:

for x in $(seq 5); do echo $x; go run test.go; done
1
2020/10/14 23:34:52 Get "https://tls13.1d.pw/": remote error: tls: error decoding message
exit status 1
2
2020/10/14 23:34:52 Success
3
2020/10/14 23:34:53 Get "https://tls13.1d.pw/": remote error: tls: error decoding message
exit status 1
4
2020/10/14 23:34:53 Success
5
2020/10/14 23:34:54 Get "https://tls13.1d.pw/": remote error: tls: error decoding message
exit status 1

Here are 2 pcaps of good and failed requests:
pcap.zip

What did you expect to see?

A successful http request

What did you see instead?

go run test.go
2020/10/14 23:30:25 Get "https://tls13.1d.pw/": remote error: tls: error decoding message
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions