CVE-2025-6224: juju/utils leaks private key in certs
6.5
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
github.com/juju/utils/v4/cert | go | <= 4.0.3 | 4.0.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from a fundamental misuse of Go's cryptographic APIs in the cert.NewLeaf
function. The developer intended to generate a SubjectKeyId
by hashing the public part of a key. However, the code sha512.New384().Sum(key)
was used. This code does not hash the provided key
. Instead, it computes the hash of an empty input and appends it to the key
slice, which contains the private key material. Since the SubjectKeyId
is a public part of an X.509 certificate, this action directly embeds the private key into the certificate itself.
Any application using the NewLeaf
function, or wrappers like NewCA
and NewClientCert
, to generate certificates would create credentials with this critical flaw. An attacker who obtains such a certificate (e.g., during a TLS handshake) can easily extract the private key. This allows the attacker to impersonate the identity associated with the certificate, compromising the security of the system.
The patch addresses this vulnerability by completely removing the problematic certificate generation functionality from the juju/utils
library, thereby eliminating the vulnerable functions and preventing their misuse.