CVE-2026-45571: go-git: Crafted repositories may modify main and submodule .git directories
Impact A path validation issue in go-git could allow crafted repository data to affect files outside the intended checkout target, including the repository's .git directory. These validations were introduced in upstream Git years ago, so the vulnerability arose from go-git drifting from those checks.
Published May 19, 2026 · Updated Jun 8, 2026
Affected packages
github.com/go-git/go-git/v5
- Ecosystem
- Go
- Affected
- <= 5.19.0
- Fixed in
- 5.19.1
- Check
go list -m github.com/go-git/go-git/v5
github.com/go-git/go-git/v6
- Ecosystem
- Go
- Affected
- <= 6.0.0-alpha.3
- Fixed in
- 6.0.0-alpha.4
- Check
go list -m github.com/go-git/go-git/v6
github.com/go-git/go-git
- Ecosystem
- Go
- Affected
- <= 44.7.0
- Fixed in
- No patched version yet
- Check
go list -m github.com/go-git/go-git
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
A path validation issue in go-git could allow crafted repository data to affect files outside the intended checkout target, including the repository's .git directory.
These validations were introduced in upstream Git years ago, so the vulnerability arose from go-git drifting from those checks. Some attack vectors were platform-specific: certain payloads affected only Windows users, others affected only macOS users, and some applied across all supported platforms.
Using non-descendant go-billy filesystem instances, or different filesystem types, for the Storer and Worktree may provide some isolation against .git directory manipulation. For example, users that store the .git directory through memfs while using osfs for the worktree are not affected by this vulnerability in the main repository, because repository metadata is not materialized inside the worktree filesystem.
However, this isolation does not necessarily apply when the repository contains submodules, since submodule dotgit directories may still be represented or materialized within the worktree context.
It is important to note that exploitation requires a maliciously crafted repository payload. Users should always exercise caution when interacting with repositories or Git servers they do not trust.
Patches
Users should upgrade to a patched version 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.
Credits
Thanks to @kodareef5, @AyushParkara and @N0zoM1z0 for reporting this to the go-git project in three separate reports. 🙇
Credited to AyushParkara, N0zoM1z0.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-71556
go-git: Worktree operations may follow symlinks
high7.1Aug 7, 2026CVE-2026-71557
go-git: Malicious reference names may modify files outside the reference storage
medium6.3Aug 7, 2026GHSA-w5pp-99ch-qj29
go-git: Malformed Git object data may cause panics or resource exhaustion
medium6.5May 29, 2026CVE-2026-45570
go-git: Improper single-quote escaping in go-git SSH transport
low2.3No fixMay 19, 2026CVE-2026-45022
go-git's improper parsing of specially crafted objects may lead to inconsistent interpretation compared to upstream Git
high7.0May 11, 2026CVE-2026-41506
go-git: Credential leak via cross-host redirect in smart HTTP transport
medium4.7Apr 17, 2026
