CVE-2025-6224: Github.com/juju/utils/v4/cert Juju/utils Leaks Private Key Vulnerability

MODERATE
Advisory Identifier: GHSA-h34r-jxqm-qgpr
CVSS 6.5
CWE-312
Published
Advisory Summary

CVE-2025-6224 is a MODERATE (CVSS 6.5) juju/utils leaks private key vulnerability (CWE-312: Cleartext Storage of Sensitive Information) affecting Github.com/juju/utils/v4/cert libraries in the Go ecosystem. The issue involves juju/utils leaks private key in certs. Remediation is available by upgrading affected packages to version 4.0.4.

CVE-2025-6224 at a Glance

CVE Identifier CVE-2025-6224
GHSA Identifier GHSA-h34r-jxqm-qgpr
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-312: Cleartext Storage of Sensitive Information
Affected Product Github.com/juju/utils/v4/cert
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-6224

To remediate this vulnerability, upgrade all affected Github.com/juju/utils/v4/cert dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/juju/utils/v4/cert fixed: 4.0.4
Upgrade github.com/juju/utils/v4/cert to 4.0.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/juju/utils/v4/cert

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-6224, inspect your project dependencies for Github.com/juju/utils/v4/cert:

inspect dependencies for github.com/juju/utils/v4/cert

Analyze the terminal output to locate any version of Github.com/juju/utils/v4/cert in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-312: Cleartext Storage of Sensitive Information, where the product stores sensitive information in cleartext within a resource that might be accessible to another control sphere. In Github.com/juju/utils/v4/cert, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://github.com/juju/utils/blob/0141ef0ee74a0cac603c5c9e4aff194008722f41/cert/cert.go#L120) (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.

CVE-2025-6224 Affected Github.com/juju/utils/v4/cert Versions

1 component(s)
Fixed Versions:
4.0.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/juju/utils/v4/cert
Go
< 4.0.4
4.0.4

References

Frequently Asked Questions

What is CVE-2025-6224?
CVE-2025-6224 is a security vulnerability in Github.com/juju/utils/v4/cert involving juju/utils leaks private key in certs under CWE-312: Cleartext Storage of Sensitive Information.
Which Github.com/juju/utils/v4/cert versions are affected?
Affected versions include releases prior to 4.0.4 across affected packages: github.com/juju/utils/v4/cert.
What version fixes CVE-2025-6224?
Upgrading to 4.0.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/juju/utils/v4/cert affected?
Yes, github.com/juju/utils/v4/cert is affected in releases prior to 4.0.4. Upgrade your dependency to 4.0.4 or later.
What is the CVSS score of CVE-2025-6224?
CVE-2025-6224 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-6224?
CVE-2025-6224 is classified under CWE-312: Cleartext Storage of Sensitive Information (The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.).
How can I check Go dependencies for CVE-2025-6224?
Run the dependency tree command: 'inspect dependencies for github.com/juju/utils/v4/cert'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h34r-jxqm-qgpr",
  "modified" : "2025-07-01T17:35:16Z",
  "published" : "2025-07-01T17:35:16Z",
  "aliases" : [ "CVE-2025-6224" ],
  "summary" : "juju/utils leaks private key in certs",
  "details" : "### Summary\n\nCerts generated by v4 contain their private key.\n\n## Details\n\n### Background\n\nRecently, 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. \n\nThis work is a hobby project and has no affiliation with my employer, so I may be slow to respond due to existing commitments. \n\n### PoC\n\nhttps://go.dev/play/p/vSW0U3Hq4qk\n\n### Impact\n\n[This code](https://github.com/juju/utils/blob/0141ef0ee74a0cac603c5c9e4aff194008722f41/cert/cert.go#L120) (cert.NewLeaf) generates certs with the SubjectKeyId set to `sha512.New384().Sum(/* private */ key)`.\n\nIf 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.\n\nGetting 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.\n\nSimilarly, 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/juju/utils/v4/cert"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.0.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/juju/utils/security/advisories/GHSA-h34r-jxqm-qgpr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-6224"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/juju/utils/commit/766f27d7bcd10433453a9764509a864c17a46a76"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/juju/utils"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/juju/utils/releases/tag/v4.0.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-312" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-01T17:35:16Z",
    "nvd_published_at" : "2025-07-01T11:15:21Z"
  }
}