CVE-2026-41506: go-git Credential Leak Vulnerability
MODERATECVE-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
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).
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.
Upgrade github.com/go-git/go-git/v5 to 5.18.0
Upgrade github.com/go-git/go-git/v6 to 6.0.0-alpha.2
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
CVE-2026-41506 Affected go-git Versions
2 component(s)| 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?
Which go-git versions are affected?
What version fixes CVE-2026-41506?
Is github.com/go-git/go-git/v5 affected?
Is github.com/go-git/go-git/v6 affected?
What is the CVSS score of CVE-2026-41506?
What CWE is associated with CVE-2026-41506?
How can I check Go dependencies for CVE-2026-41506?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}