CVE-2025-65965: Github.com/anchore/grype Grype Has A Credential Disclosure Vulnerability

HIGH
Advisory Identifier: GHSA-6gxw-85q2-q646
CWE-212
Published
Advisory Summary

CVE-2025-65965 is a HIGH grype has a credential disclosure vulnerability (CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer) affecting Github.com/anchore/grype libraries in the Go ecosystem. The issue involves grype has a credential disclosure vulnerability in its json output. Remediation is available by upgrading affected packages to version 0.104.1.

CVE-2025-65965 at a Glance

CVE Identifier CVE-2025-65965
GHSA Identifier GHSA-6gxw-85q2-q646
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer
Affected Product Github.com/anchore/grype
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-65965

To remediate this vulnerability, upgrade all affected Github.com/anchore/grype 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/anchore/grype fixed: 0.104.1
Upgrade github.com/anchore/grype to 0.104.1
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/anchore/grype

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-65965, inspect your project dependencies for Github.com/anchore/grype:

inspect dependencies for github.com/anchore/grype

Analyze the terminal output to locate any version of Github.com/anchore/grype in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.104.1), 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-212: Improper Removal of Sensitive Information Before Storage or Transfer, where the product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors. In Github.com/anchore/grype, 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

A credential disclosure vulnerability was found in Grype, affecting versions `v0.68.0` through `v0.104.0`. If registry credentials are defined and the output of grype is written using the `--file` or `--output json=<file>` option, the registry credentials will be included unsanitized in the output file. ## Impact In Grype versions `v0.68.0` through `v0.104.0`, when registry authentication is configured, those credentials can be incorrectly included in the output of a Grype scan (regardless of whether those credentials are actively being used for the current scan). Users that do not have registry authentication configured are not affected by this issue. Registry credentials can be set via the Grype configuration file (e.g. `registry.auth[].username`, `registry.auth[].password`, `registry.auth[].token`) or environment variables (e.g., `GRYPE_REGISTRY_AUTH_USERNAME`, `GRYPE_REGISTRY_AUTH_PASSWORD`, `GRYPE_REGISTRY_AUTH_TOKEN`). In order for the authentication details to be improperly included, the Grype file output format must be set to `json` with output target set to a file. For example `--output json=file.json` or `--output json --file file.json`. When these conditions are met, the configured credentials are not sanitized as they should be in the resulting JSON output file. The authentication details could also be leaked via a malformed Grype Template. A Grype Template that includes the `Descriptor.Registry.Auth` fields would also include the unsanitized registry credentials. There are no known templates that include these fields. ## Patches The patch has been released in `v0.104.1`. ## Workaround Users running affected versions of grype can work around this vulnerability by redirecting stdout to a file instead of using the `--file` or `--output` options. For example, replacing the command: ``` # using `--output json=path` (or `--file`) leaks credentials grype --output json=test.json alpine:latest ``` with ``` # no use of `--output json=path` or `--file`. Output is sanitized... grype --output json alpine:latest > test.json ``` ...results in the same `test.json` output, but the credentials will be properly sanitized. ## Resources Patch pull request: https://github.com/anchore/grype/pull/3068

CVE-2025-65965 Affected Github.com/anchore/grype Versions

1 component(s)
Fixed Versions:
0.104.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/anchore/grype
Go
≥ 0.68.0
< 0.104.1
0.104.1

References

Frequently Asked Questions

What is CVE-2025-65965?
CVE-2025-65965 is a security vulnerability in Github.com/anchore/grype involving Grype has a credential disclosure vulnerability in its JSON output under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer.
Which Github.com/anchore/grype versions are affected?
Affected versions include releases prior to 0.104.1 across affected packages: github.com/anchore/grype.
What version fixes CVE-2025-65965?
Upgrading to 0.104.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/anchore/grype affected?
Yes, github.com/anchore/grype is affected in releases prior to 0.104.1. Upgrade your dependency to 0.104.1 or later.
What CWE is associated with CVE-2025-65965?
CVE-2025-65965 is classified under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer (The product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors.).
How can I check Go dependencies for CVE-2025-65965?
Run the dependency tree command: 'inspect dependencies for github.com/anchore/grype'. 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-6gxw-85q2-q646",
  "modified" : "2025-11-27T08:42:37Z",
  "published" : "2025-11-25T14:18:46Z",
  "aliases" : [ "CVE-2025-65965" ],
  "summary" : "Grype has a credential disclosure vulnerability in its JSON output",
  "details" : "A credential disclosure vulnerability was found in Grype, affecting versions `v0.68.0` through `v0.104.0`. If registry credentials are defined and the output of grype is written using the `--file` or `--output json=<file>` option, the registry credentials will be included unsanitized in the output file.\n\n## Impact\n\nIn Grype versions `v0.68.0` through `v0.104.0`, when registry authentication is configured, those credentials can be incorrectly included in the output of a Grype scan (regardless of whether those credentials are actively being used for the current scan). Users that do not have registry authentication configured are not affected by this issue.\n\nRegistry credentials can be set via the Grype configuration file (e.g. `registry.auth[].username`, `registry.auth[].password`, `registry.auth[].token`) or environment variables (e.g., `GRYPE_REGISTRY_AUTH_USERNAME`, `GRYPE_REGISTRY_AUTH_PASSWORD`, `GRYPE_REGISTRY_AUTH_TOKEN`).\n\nIn order for the authentication details to be improperly included, the Grype file output format must be set to `json` with output target set to a file. For example `--output json=file.json` or `--output json --file file.json`. When these conditions are met, the configured credentials are not sanitized as they should be in the resulting JSON output file.\n\nThe authentication details could also be leaked via a malformed Grype Template. A Grype Template that includes the `Descriptor.Registry.Auth` fields would also include the unsanitized registry credentials. There are no known templates that include these fields.\n\n## Patches\nThe patch has been released in `v0.104.1`.\n\n## Workaround\nUsers running affected versions of grype can work around this vulnerability by redirecting stdout to a file instead of using the `--file` or `--output` options.\n\nFor example, replacing the command:\n\n```\n# using `--output json=path` (or `--file`) leaks credentials\ngrype --output json=test.json alpine:latest\n```\n\nwith\n\n```\n# no use of `--output json=path` or `--file`. Output is sanitized...\ngrype --output json alpine:latest > test.json\n```\n\n...results in the same `test.json` output, but the credentials will be properly sanitized.\n\n## Resources\nPatch pull request: https://github.com/anchore/grype/pull/3068",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/anchore/grype"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.68.0"
      }, {
        "fixed" : "0.104.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/anchore/grype/security/advisories/GHSA-6gxw-85q2-q646"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-65965"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/anchore/grype/pull/3068"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/anchore/grype/commit/39f7fa17af2739cafe9b27176d4a68f7c05f21c1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/anchore/grype/commit/c99f79de49a58dc16d7fd8f35160b169b87db9de"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/anchore/grype"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-212" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-11-25T14:18:46Z",
    "nvd_published_at" : "2025-11-25T20:16:00Z"
  }
}