Skip to content

crypto/x509: RevocationList.CheckSignatureFrom doesn't check Subject #60728

Description

@thierry-f-78

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

$ go version
go version go1.20.5 darwin/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="/Users/thierry/Library/Caches/go-build"
GOENV="/Users/thierry/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/thierry/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/thierry/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/thierry/git/XXX/poc/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_d/zs7l5ldx1r94fn_qh1zvn1rw0000gn/T/go-build3292834562=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I try to validate CRL files. I use three CA certificate:

  • The first one (ca.pem) is the legit certificate which sign the CRL
  • The second one (ca_very_wrong.pem) is wrong certificate with any key
  • The third one (ca_wrong.pem) is not the right CA certificate but it have the same private key than (ca.pem)

With openssl I observe this behaviour:

$ openssl crl -in ca.crl -CAfile ca.pem -noout
verify OK

$ openssl crl -in ca.crl -CAfile ca_very_wrong.pem -noout
Error getting CRL issuer certificate

$ openssl crl -in ca.crl -CAfile ca_wrong.pem -noout
Error getting CRL issuer certificate

It's the expected behaviour.

With Golang primitives, the last case is true. This behaviour is wrong.

I join zip file with a poc.

What did you expect to see?

I Expect the function CheckSignatureFrom() with certificate ca_wrong.pem return an error

What did you see instead?

Function CheckSignatureFrom() with certificate ca_wrong.pem end with success

poc.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions