CVE-2020-14039: X509 Certificate Verification Bypass in Go crypto/x509
Summary
CVE-2020-14039: Certificate verification error on Windows in crypto/x509. Affects stdlib across 2 version ranges.
< 1.13.13
>= 1.14.0-0, < 1.14.5
Fixed in 1.13.13 or 1.14.5, depending on the release line you run. How to fix ↓
Also tracked for
- golang · Bitnami
The same CVE-2020-14039 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The crypto/x509 package in the Go programming language provides functionality for working with X.509 certificates. X.509 is a standard format for public key certificates used in various cryptographic protocols. The package allows for the parsing, verification, and manipulation of X.509 certificates.
Vulnerability Detail
The vulnerability identified as CVE-2020-14039 affects the X509 certificate verification process in the crypto/x509 package on Windows systems. Specifically, when the VerifyOptions.Roots field is set to nil, the package fails to validate the KeyUsages Extended Key Usage (EKU) requirements. This oversight allows an attacker to bypass certificate verification and potentially use a malicious certificate to impersonate a trusted entity or perform other unauthorized actions.
How To Fix
Latest published version: go1.25.5 as of 22 Oct 2026
go get stdlib@vgo1.25.5
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 1.13.131.13.13go get stdlib@v1.13.13 -
>= 1.14.0-0, < 1.14.51.14.5go get stdlib@v1.14.5
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a workaround, developers can manually validate the KeyUsages EKU requirements in their code before calling the Certificate.Verify function. Here is an example of how this can be done:
func verifyCertificate(cert *x509.Certificate) (bool, error) {
for _, eku := range cert.ExtKeyUsage {
if eku == x509.ExtKeyUsageServerAuth || eku == x509.ExtKeyUsageClientAuth {
return true, nil
}
}
return false, errors.New("Certificate does not have the required KeyUsages EKU")
}
func main() {
// Load and parse the certificate
cert, err := x509.ParseCertificate(certData)
if err != nil {
log.Fatal(err)
}
// Manually verify the certificate
valid, err := verifyCertificate(cert)
if err != nil {
log.Fatal(err)
}
// Proceed with further actions if the certificate is valid
if valid {
// ...
}
}
Conclusion
In conclusion, the CVE-2020-14039 vulnerability in the crypto/x509 package allows for bypassing certificate verification on Windows systems. Developers should update to the fixed versions of the package or manually validate the KeyUsages EKU requirements to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for stdlib →
FAQ
The vulnerability allows an attacker to bypass certificate verification, potentially leading to the use of malicious certificates to impersonate trusted entities or perform unauthorized actions.
The vulnerability affects versions 0.0.0 to 1.13.12 and versions 1.14.0 to 1.14.4 of the crypto/x509 package.
No, only Windows systems using the affected versions of the crypto/x509 package and with the VerifyOptions.Roots field set to nil are vulnerable.
Yes, developers can update to version 1.13.13 or later, or version 1.14.5 or later of the crypto/x509 package to fix this vulnerability.
Yes, developers can manually validate the KeyUsages EKU requirements in their code as a workaround. The provided example demonstrates how to do this.
References
Related vulnerabilities
Recent vulnerabilities recorded for stdlib.