CVE-2026-71557: go-git: Malicious reference names may modify files outside the reference storage
Impact A path traversal issue in go-git could allow malicious reference names to access files outside the repository's intended reference storage. Loose references are stored under .git/ . The reference name was previously used as a path without verifying that the resolved path remained within the reference storage.
Published Aug 7, 2026
Affected packages
github.com/go-git/go-git/v5
- Ecosystem
- Go
- Affected
- <= 5.19.1
- Fixed in
- 5.19.2
- 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.4
- Fixed in
- 6.0.0-alpha.5
- Check
go list -m github.com/go-git/go-git/v6
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
A path traversal issue in go-git could allow malicious reference names to access files outside the repository's intended reference storage.
Loose references are stored under .git/<reference-name>. The reference name was previously used as a path without verifying that the resolved path remained within the reference storage. A name such as refs/heads/../../config could therefore resolve to unrelated repository metadata such as .git/config or .git/HEAD.
A malicious Git server could advertise such a reference name. The name may also survive refspec mapping; for example, it could be mapped to refs/remotes/origin/../../config during a clone or fetch operation.
This vulnerability affects filesystem-backed repositories using the storage/filesystem package and its dotgit reference storage. Users relying exclusively on the in-memory storage implementation, storage/memory, are not affected, because reference names are not resolved as filesystem paths.
Exploitation requires an application using go-git with filesystem-backed storage to interact with a malicious Git server or otherwise process attacker-controlled reference names.
Patches
The issue has been addressed by validating reference names at the dotgit storage entry points and rejecting names whose resolved paths could escape the reference storage.
Users of filesystem-backed storage should upgrade to a patched version.
Workarounds
Applications that exclusively use storage/memory are not affected and do not require a workaround for this vulnerability.
For applications using filesystem-backed storage, avoid cloning from or fetching from untrusted Git servers until an upgrade is possible.
Applications that directly construct or process reference names may also validate them before passing them to filesystem-backed go-git storage. Application-level validation should only be considered a temporary mitigation and does not replace upgrading to a patched version.
References
- Fixes:
- https://github.com/go-git/go-git/pull/2247
- https://github.com/go-git/go-git/pull/2254
Credits
Thanks to @Saku0512 for reporting this issue and @Sahana2524 for proposing the initial fix. 🙇
Credited to Saku0512.
References
- https://github.com/go-git/go-git/security/advisories/GHSA-qgq7-7hm3-q39j
- https://github.com/go-git/go-git/pull/2247
- https://github.com/go-git/go-git/pull/2254
- https://github.com/go-git/go-git/commit/4a0e66d555de5f9a30c31e2df64f445f42bd01e7
- https://github.com/go-git/go-git/commit/da9f7d8a0e98b475600177348d6ece384a370f36
- https://github.com/go-git/go-git/releases/tag/v5.19.2
- https://github.com/go-git/go-git/releases/tag/v6.0.0-alpha.5
- https://github.com/advisories/GHSA-qgq7-7hm3-q39j
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, 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-45571
go-git: Crafted repositories may modify main and submodule .git directories
medium5.4No 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
