CVE-2025-22865 ParsePKCS1PrivateKey panic with partial keys in crypto/x509

High 7.5 Published Updated

An attacker can cause a denial of service by providing a malformed RSA private key to the Go crypto/x509 package, triggering a panic.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-22865?

CVE-2025-22865 is a high-severity denial of service vulnerability in Go standard library crypto/x509, published on 28 Jan 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Using ParsePKCS1PrivateKey to parse a RSA key that is missing the CRT values would panic when verifying that the key is well formed.

Which versions are affected by CVE-2025-22865?

2 open source packages ship an affected version, including golang and stdlib.

PackageAffectedFixed in
golang BitnamiFrom 1.24.0-01.24.0-rc.2
stdlib GoFrom 1.24.0-01.24.0-rc.2

How do I fix CVE-2025-22865?

Upgrade golang to 1.24.0-rc.2 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2025-22865 being exploited?

There is no known exploitation of CVE-2025-22865 in the wild and no public exploit code.

Sources

Also known as BIT-golang-2025-22865, DEBIAN-CVE-2025-22865, ECHO-633d-3526-5d52, GHSA-v7qx-rccr-23xm, GO-2025-3421, UBUNTU-CVE-2025-22865.

Is CVE-2025-22865 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free