Miggo Logo

CVE-2025-6224: juju/utils leaks private key in certs

6.5

CVSS Score
3.1

Basic Information

EPSS Score
0.00503%
Published
7/1/2025
Updated
7/1/2025
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/juju/utils/v4/certgo<= 4.0.34.0.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Summ*ry **rts **n*r*t** *y v* *ont*in t**ir priv*t* k*y. ## **t*ils ### ***k*roun* R***ntly, I *n*ount*r** *n *PI in *o t**t’s **sy to misus*: s*****.Sum*** *n* s*****.N*w***().Sum look v*ry simil*r *n* ****v* v*ry *i***r*ntly. *ttps://*o.**v

Reasoning

T** vuln*r**ility st*ms *rom * *un**m*nt*l misus* o* *o's *rypto*r*p*i* *PIs in t** `**rt.N*wL***` *un*tion. T** **v*lop*r int*n*** to **n*r*t* * `Su*j**tK*yI*` *y **s*in* t** pu*li* p*rt o* * k*y. *ow*v*r, t** *o** `s*****.N*w***().Sum(k*y)` w*s us*