CVE-2026-41506: go-git Credential Leak Vulnerability

MODERATE
Advisory Identifier: GHSA-3xc5-wrhm-f963
CVSS 4.7
CWE-522
Published
Advisory Summary

CVE-2026-41506 is a MODERATE (CVSS 4.7) credential leak vulnerability (CWE-522: Insufficiently Protected Credentials) affecting go-git libraries in the Go ecosystem. The issue involves credential leak via cross-host redirect in smart http transport. Remediation is available by upgrading affected packages to version 5.18.0, 6.0.0-alpha.2.

CVE-2026-41506 at a Glance

CVE Identifier CVE-2026-41506
GHSA Identifier GHSA-3xc5-wrhm-f963
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product go-git
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 4.7

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:C/C:L/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 Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-41506

To remediate this vulnerability, upgrade all affected go-git 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/go-git/go-git/v5 fixed: 5.18.0
Upgrade github.com/go-git/go-git/v5 to 5.18.0
github.com/go-git/go-git/v6 fixed: 6.0.0-alpha.2
Upgrade github.com/go-git/go-git/v6 to 6.0.0-alpha.2
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/go-git/go-git/v5

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41506, inspect your project dependencies for go-git:

inspect dependencies for github.com/go-git/go-git/v5

Analyze the terminal output to locate any version of go-git in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.18.0), 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-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In go-git, 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

### Impact `go-git` may leak HTTP authentication credentials when following redirects during smart-HTTP clone and fetch operations. If a remote repository responds to the initial `/info/refs` request with a redirect to a different host, go-git updates the session endpoint to the redirected location and reuses the original authentication for subsequent requests. This can result in the credentials (e.g. Authorization headers) being sent to an unintended host. An attacker controlling or influencing the redirect target can capture these credentials and potentially reuse them to access the victim’s repositories or other resources, depending on the scope of the credential. **Clients using `go-git` exclusively with trusted remotes (for example, GitHub or GitLab), and over a secure HTTPS connection, are not affected by this issue.** The risk arises when interacting with untrusted or misconfigured Git servers, or when using unsecured HTTP connections, which is not recommended. Such configurations also expose clients to a broader class of security risks beyond this issue, including credential interception and tampering of repository data. ### Patches Users should upgrade to `v5.18.0`, or `v6.0.0-alpha.2`, in order to mitigate this vulnerability. Versions prior to v5 are likely to be affected, users are recommended to upgrade to a supported `go-git` version. The patched versions add support for configuring [followRedirects](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects). In line with upstream behaviour, the default is now `initial`, while users can opt into `FollowRedirects` or `NoFollowRedirects` programmatically. ### Credit Thanks to the 3 separate reports from @celinke97, @N0zoM1z0 and @AyushParkara. Thanks for finding and reporting this issue privately to the `go-git` project. :bow:

CVE-2026-41506 Affected go-git Versions

2 component(s)
Fixed Versions:
5.18.06.0.0-alpha.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-git/go-git/v5
Go
< 5.18.0
5.18.0
github.com/go-git/go-git/v6
Go
< 6.0.0-alpha.2
6.0.0-alpha.2

References

Frequently Asked Questions

What is CVE-2026-41506?
CVE-2026-41506 is a security vulnerability in go-git involving Credential leak via cross-host redirect in smart HTTP transport under CWE-522: Insufficiently Protected Credentials.
Which go-git versions are affected?
Affected versions include releases prior to 5.18.0, 6.0.0-alpha.2 across affected packages: github.com/go-git/go-git/v5, github.com/go-git/go-git/v6.
What version fixes CVE-2026-41506?
Upgrading to 5.18.0, 6.0.0-alpha.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-git/go-git/v5 affected?
Yes, github.com/go-git/go-git/v5 is affected in releases prior to 5.18.0. Upgrade your dependency to 5.18.0 or later.
Is github.com/go-git/go-git/v6 affected?
Yes, github.com/go-git/go-git/v6 is affected in releases prior to 6.0.0-alpha.2. Upgrade your dependency to 6.0.0-alpha.2 or later.
What is the CVSS score of CVE-2026-41506?
CVE-2026-41506 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2026-41506?
CVE-2026-41506 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check Go dependencies for CVE-2026-41506?
Run the dependency tree command: 'inspect dependencies for github.com/go-git/go-git/v5'. 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-3xc5-wrhm-f963",
  "modified" : "2026-05-12T13:32:21Z",
  "published" : "2026-04-17T22:31:35Z",
  "aliases" : [ "CVE-2026-41506" ],
  "summary" : "go-git: Credential leak via cross-host redirect in smart HTTP transport",
  "details" : "### Impact\n`go-git` may leak HTTP authentication credentials when following redirects during smart-HTTP clone and fetch operations.\n\nIf a remote repository responds to the initial `/info/refs` request with a redirect to a different host, go-git updates the session endpoint to the redirected location and reuses the original authentication for subsequent requests. This can result in the credentials (e.g. Authorization headers) being sent to an unintended host.\n\nAn attacker controlling or influencing the redirect target can capture these credentials and potentially reuse them to access the victim’s repositories or other resources, depending on the scope of the credential.\n\n**Clients using `go-git` exclusively with trusted remotes (for example, GitHub or GitLab), and over a secure HTTPS connection, are not affected by this issue.** The risk arises when interacting with untrusted or misconfigured Git servers, or when using unsecured HTTP connections, which is not recommended. Such configurations also expose clients to a broader class of security risks beyond this issue, including credential interception and tampering of repository data.\n\n### Patches\nUsers should upgrade to `v5.18.0`, or `v6.0.0-alpha.2`, in order to mitigate this vulnerability. Versions prior to v5 are likely to be affected, users are recommended to upgrade to a supported `go-git` version.\n\nThe patched versions add support for configuring [followRedirects](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects). In line with upstream behaviour, the default is now `initial`, while users can opt into `FollowRedirects` or `NoFollowRedirects` programmatically.\n\n### Credit\nThanks to the 3 separate reports from @celinke97, @N0zoM1z0 and @AyushParkara. Thanks for finding and reporting this issue privately to the `go-git` project. :bow:",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-git/go-git/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.18.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.17.2"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-git/go-git/v6"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.0-alpha.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.0-alpha.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-git/go-git/security/advisories/GHSA-3xc5-wrhm-f963"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41506"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-git/go-git"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-git/go-git/releases/tag/v5.18.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-git/go-git/releases/tag/v6.0.0-alpha.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-17T22:31:35Z",
    "nvd_published_at" : "2026-05-08T14:16:33Z"
  }
}