# CVE-2026-41506: go-git credential leak via cross-host redirect in smart HTTP transport

Source: https://junglewise.ai/threats/cve-2026-41506-go-git-credential-leak-via-cross-host-redirect-in-smart-http  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-08. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

CVE-2026-41506 · Severity: medium · CVSS 4.7 · Published 2026-05-08

go-git is a library used by developers to integrate Git functionality into Go applications. A security flaw allows sensitive login credentials to be leaked to unauthorized third-party servers when the library follows a web redirect during repository operations. This could allow an attacker who controls a malicious Git server to steal user credentials and gain unauthorized access to other private repositories or resources.

Technologies: [github.com/go-git/go-git/v5 (Go)](https://junglewise.ai/threats/technologies/github-com-go-git-go-git-v5), [github.com/go-git/go-git/v6 (Go)](https://junglewise.ai/threats/technologies/github-com-go-git-go-git-v6), [Go-Git](https://junglewise.ai/threats/technologies/go-git). Vendors: [Go](https://junglewise.ai/threats/vendors/go), [Go-Git](https://junglewise.ai/threats/vendors/go-git).

## Quick answers

**Is CVE-2026-41506 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-41506 being exploited in the wild.

**How severe is CVE-2026-41506?** Medium severity, with a CVSS score of 4.7, published 8 May 2026.

**Which products and versions are affected?** github.com/go-git/go-git/v5 (Go) <= 5.17.2, SEMVER:introduced=0,fixed=5.18.0; github.com/go-git/go-git/v6 (Go) <= 6.0.0-alpha.1, SEMVER:introduced=0,fixed=6.0.0-alpha.2; Go-Git < 5.18.0.

**Is there a fix for CVE-2026-41506?** Yes. github.com/go-git/go-git/v5 (Go): upgrade to 5.18.0 or later; github.com/go-git/go-git/v6 (Go): upgrade to 6.0.0-alpha.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-41506 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-41506?** Check whether you run github.com/go-git/go-git/v5 (Go), github.com/go-git/go-git/v6 (Go) or Go-Git at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- github.com/go-git/go-git/v5 (Go): upgrade to 5.18.0 or later

  ```sh
  go get github.com/go-git/go-git/v5@v5.18.0
  ```

- github.com/go-git/go-git/v6 (Go): upgrade to 6.0.0-alpha.2 or later

  ```sh
  go get github.com/go-git/go-git/v6@v6.0.0-alpha.2
  ```


## Technical details

A credential leak vulnerability exists in go-git's smart-HTTP transport implementation. When a remote repository responds to an initial /info/refs request with a redirect to a different host, go-git updates the session endpoint to the new location but reuses the original Authorization headers for subsequent requests. This allows an attacker-controlled server to capture credentials intended for the original host. The vulnerability is rooted in insufficient protection of credentials during cross-host redirects (CWE-522). The issue is addressed in versions 5.18.0 and 6.0.0-alpha.2 by introducing a configurable followRedirects policy that defaults to 'initial' only, matching canonical Git behavior.

## Affected products

- go-git go-git/v5 < 5.18.0
- go-git go-git/v6 < 6.0.0-alpha.2

## Identifiers

- CVE-2026-41506
- GHSA-3xc5-wrhm-f963
- GO-2026-5105

## Timeline

- 2026-04-16: patched: Versions 5.18.0 and 6.0.0-alpha.2 released
- 2026-05-08: disclosed: Initial CVE publication
- 2026-05-08: advisory: GitHub Security Advisory published

## References

- [https://github.com/go-git/go-git/releases/tag/v5.18.0](https://github.com/go-git/go-git/releases/tag/v5.18.0)
- [https://github.com/go-git/go-git/releases/tag/v6.0.0-alpha.2](https://github.com/go-git/go-git/releases/tag/v6.0.0-alpha.2)
- [https://github.com/go-git/go-git/security/advisories/GHSA-3xc5-wrhm-f963](https://github.com/go-git/go-git/security/advisories/GHSA-3xc5-wrhm-f963)

## Related threats

- [go-git path traversal via malicious reference names](https://junglewise.ai/threats/cve-2026-71557-go-git-path-traversal-via-malicious-reference-names)
- [go-git symlink traversal in worktree operations](https://junglewise.ai/threats/cve-2026-71556-go-git-symlink-traversal-in-worktree-operations)
- [GO-2026-5693 - Go-git: Malformed Git object data may cause panics or resource exhaustion in github.com/go-git/go-git](https://junglewise.ai/threats/go-2026-5693-go-git-malformed-git-object-data-may-cause-panics-or-9c82fa09)
- [go-git go-billy denial of service via improper input handling](https://junglewise.ai/threats/cve-2026-44740-go-git-go-billy-denial-of-service-via-improper-input-handling)
- [go-git DoS via malformed Git object data](https://junglewise.ai/threats/go-git-dos-via-malformed-git-object-data-a3075e9b)
