CVE-2026-71557: go-git Malicious Reference Names May Modify Vulnerability
MODERATECVE-2026-71557 is a MODERATE (CVSS 6.3) malicious reference names may modify vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting go-git libraries in the Go ecosystem. The issue involves malicious reference names may modify files outside the reference storage. Remediation is available by upgrading affected packages to version 5.19.2, 6.0.0-alpha.5.
CVE-2026-71557 at a Glance
Security Impact
CVSS: 6.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L).
How to Fix CVE-2026-71557
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.19.2
Upgrade github.com/go-git/go-git/v6 to 6.0.0-alpha.5
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-71557, 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.19.2), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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-71557 Affected go-git Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/go-git/go-git/v5
|
Go |
< 5.19.2
|
5.19.2
|
|
github.com/go-git/go-git/v6
|
Go |
< 6.0.0-alpha.5
|
6.0.0-alpha.5
|
References
Frequently Asked Questions
What is CVE-2026-71557?
Which go-git versions are affected?
What version fixes CVE-2026-71557?
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-71557?
What CWE is associated with CVE-2026-71557?
How can I check Go dependencies for CVE-2026-71557?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qgq7-7hm3-q39j",
"modified" : "2026-08-07T16:41:51Z",
"published" : "2026-08-07T16:41:51Z",
"aliases" : [ "CVE-2026-71557" ],
"summary" : "go-git: Malicious reference names may modify files outside the reference storage",
"details" : "### Impact\nA path traversal issue in `go-git` could allow malicious reference names to access files outside the repository's intended reference storage.\n\nLoose 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`.\n\nA 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.\n\nThis 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.\n\nExploitation requires an application using `go-git` with filesystem-backed storage to interact with a malicious Git server or otherwise process attacker-controlled reference names.\n\n### Patches\nThe 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.\n\nUsers of filesystem-backed storage should upgrade to a patched version.\n\n### Workarounds\nApplications that exclusively use `storage/memory` are not affected and do not require a workaround for this vulnerability.\n\nFor applications using filesystem-backed storage, avoid cloning from or fetching from untrusted Git servers until an upgrade is possible.\n\nApplications 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.\n\n### References\n- Fixes:\n - https://github.com/go-git/go-git/pull/2247\n - https://github.com/go-git/go-git/pull/2254\n\n### Credits\n\nThanks to @Saku0512 for reporting this issue and @Sahana2524 for proposing the initial fix. 🙇",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git/v5"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.19.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.19.1"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git/v6"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.0-alpha.5"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 6.0.0-alpha.4"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/security/advisories/GHSA-qgq7-7hm3-q39j"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/pull/2247"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/pull/2254"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/commit/4a0e66d555de5f9a30c31e2df64f445f42bd01e7"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/commit/da9f7d8a0e98b475600177348d6ece384a370f36"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/go-git/go-git"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/releases/tag/v5.19.2"
}, {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/releases/tag/v6.0.0-alpha.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-08-07T16:41:51Z",
"nvd_published_at" : null
}
}