CVE-2026-71557: go-git: Malicious reference names may modify files outside the reference storage
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.
References
- github.com/advisories/GHSA-qgq7-7hm3-q39j
- github.com/go-git/go-git/commit/4a0e66d555de5f9a30c31e2df64f445f42bd01e7
- github.com/go-git/go-git/commit/da9f7d8a0e98b475600177348d6ece384a370f36
- github.com/go-git/go-git/pull/2247
- github.com/go-git/go-git/pull/2254
- github.com/go-git/go-git/releases/tag/v5.19.2
- github.com/go-git/go-git/releases/tag/v6.0.0-alpha.5
- github.com/go-git/go-git/security/advisories/GHSA-qgq7-7hm3-q39j
- nvd.nist.gov/vuln/detail/CVE-2026-71557
Code Behaviors & Features
Detect and mitigate CVE-2026-71557 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →