ADVISORIES

Go Vulnerability Database

GO-2026-5037

Inefficient candidate hostname parsing in crypto/x509

Details

(*x509.Certificate).VerifyHostname previously called matchHostnames in a loop over all DNS Subject Alternative Name (SAN) entries. This caused strings.Split(host, ".") to execute repeatedly on the same input hostname.

With a large DNS SAN list, verification costs scaled quadratically based on the number of SAN entries multiplied by the hostname's label count. Because x509.Verify validates hostnames before building the certificate chain, this overhead occurred even for untrusted certificates.

Affected packages

EcosystemPackageAffected versions
Gostdlib
All versions before 1.25.11 (fixed in 1.25.11)
From 1.26.0-0 before 1.26.4 (fixed in 1.26.4)

References