Skip to content

Commit 50c70e4

Browse files
thatnealpatelrickystewart
authored andcommitted
[release-branch.go1.24] crypto/x509: mitigate DoS vector when intermediate certificate contains DSA public key
An attacker could craft an intermediate X.509 certificate containing a DSA public key and can crash a remote host with an unauthenticated call to any endpoint that verifies the certificate chain. Thank you to Jakub Ciolek for reporting this issue. Fixes CVE-2025-58188 For golang#75675 Fixes golang#75702 Change-Id: I2ecbb87b9b8268dbc55c8795891e596ab60f0088 Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2780 Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2964 Reviewed-on: https://go-review.googlesource.com/c/go/+/709836 TryBot-Bypass: Michael Pratt <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Auto-Submit: Michael Pratt <[email protected]>
1 parent bd9a6e0 commit 50c70e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/crypto/x509/verify.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,10 @@ func alreadyInChain(candidate *Certificate, chain []*Certificate) bool {
873873
if !bytes.Equal(candidate.RawSubject, cert.RawSubject) {
874874
continue
875875
}
876-
if !candidate.PublicKey.(pubKeyEqual).Equal(cert.PublicKey) {
876+
// We enforce the canonical encoding of SPKI (by only allowing the
877+
// correct AI paremeter encodings in parseCertificate), so it's safe to
878+
// directly compare the raw bytes.
879+
if !bytes.Equal(candidate.RawSubjectPublicKeyInfo, cert.RawSubjectPublicKeyInfo) {
877880
continue
878881
}
879882
var certSAN *pkix.Extension

0 commit comments

Comments
 (0)