]> Cypherpunks repositories - gostls13.git/commit
crypto/x509: make sure pub key is non-nil before interface conversion
authorRoland Shoemaker <bracewell@google.com>
Thu, 18 Jan 2024 20:51:13 +0000 (12:51 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 5 Mar 2024 18:28:56 +0000 (18:28 +0000)
commitafb105056dc62b3f2f569341a9fff080023ee812
tree39efbf35acd1b728b90928668689237b83d35285
parent5e387b2feee87b7d8d5cc81e7cb08603b3e9cd6a
crypto/x509: make sure pub key is non-nil before interface conversion

alreadyInChain assumes all keys fit a interface which contains the
Equal method (which they do), but this ignores that certificates may
have a nil key when PublicKeyAlgorithm is UnknownPublicKeyAlgorithm. In
this case alreadyInChain panics.

Check that the key is non-nil as part of considerCandidate (we are never
going to build a chain containing UnknownPublicKeyAlgorithm anyway).

Fixes #65390
Fixes CVE-2024-24783

Change-Id: Ibdccc0a487e3368b6812be35daad2512220243f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2137282
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569339
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
src/crypto/x509/verify.go
src/crypto/x509/verify_test.go