CVE-2025-6224
JSON

6.5medium

Key leakage in juju/utils certificates

Severity
6.5medium CVSS:3.1 by canonical
Exploit likelihood
0.17% (higher than 5% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
canonical
Also known as
GHSA-h34r-jxqm-qgprGO-2025-3798

Description

Certificate generation in juju/utils using the cert.NewLeaf function could include private information. If this certificate were then transferred over the network in plaintext, an attacker listening on that network could sniff the certificate and trivially extract the private key from it.

Affected

Product or packageVersionsReported by
juju utilsfrom 4.0.1 up to 4.0.3CVE List
github.com/juju/utils/v4/cert (Go)before 4.0.4GitHub Advisory Database
github.com/juju/utils (Go)all versionsGo Vulnerability Database
github.com/juju/utils/v2 (Go)all versionsGo Vulnerability Database
github.com/juju/utils/v3 (Go)all versionsGo Vulnerability Database
github.com/juju/utils/v4 (Go)before 4.0.4Go Vulnerability Database
canonical juju/utilsfrom 4.0.0 before 4.0.4NVD

All scores

canonical6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Classification

CWE-312

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Certificate generation in juju/utils using the cert.NewLeaf function could include private information. If this certificate were then transferred over the network in plaintext, an attacker listening on that network could sniff the certificate and trivially extract the private key from it.

GitHub Advisory Database
Summary

Certs generated by v4 contain their private key.

Details

Background

Recently, I encountered an API in Go that’s easy to misuse: sha512.Sum384 and sha512.New384().Sum look very similar and behave very differently. https://go.dev/play/p/kDCqqoYk84k demonstrates this. I want to discuss extending static analysis to detect this case with the go community, but before I do that, I want to make a best-effort pass at open-source projects to fix the existing bugs. I figured that if there were any vulnerabilities out there, they would be easy to find once that discussion begins, so it’s better to address them early.

This work is a hobby project and has no affiliation with my employer, so I may be slow to respond due to existing commitments.

PoC

https://go.dev/play/p/vSW0U3Hq4qk

Impact

This code (cert.NewLeaf) generates certs with the SubjectKeyId set to sha512.New384().Sum(/* private */ key).

If a cert which was generated by cert.NewLeaf is transferred over the network in plaintext, as is often the case in TLS handshakes, an attacker listening on that network may sniff the cert and trivially extract the private key from it. This applies to client and server TLS certs generated by vulnerable versions of this library.

Getting the server cert and its key would only require performing a TLS handshake (with a matching SNI) with the server. At that point, the attacker could impersonate the server.

Similarly, getting the client cert and its key would require getting the client to perform a TLS handshake against an attacker-controlled server. At that point, an attacker could impersonate the client.

Go Vulnerability Database

Leaks private key in certs in github.com/juju/utils

NVD (es)

La generación de certificados en juju/utils mediante la función cert.NewLeaf podría incluir información privada. Si este certificado se transfiriera por la red en texto plano, un atacante que escuchara en esa red podría rastrearlo y extraer fácilmente su clave privada.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-6224 changed 2025-07-01CVE Terms of Use
GitHub Advisory DatabaseGHSA-h34r-jxqm-qgpr changed 2025-07-28CC-BY-4.0
Go Vulnerability DatabaseGO-2025-3798 changed 2026-03-03CC-BY-4.0
NVDCVE-2025-6224 changed 2026-06-17Public domain