GHSA-QGQ7-7HM3-Q39J
Vulnerability from github β Published: 2026-08-07 16:41 β Updated: 2026-08-07 16:41Impact
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. π
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 5.19.1"
},
"package": {
"ecosystem": "Go",
"name": "github.com/go-git/go-git/v5"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.19.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 6.0.0-alpha.4"
},
"package": {
"ecosystem": "Go",
"name": "github.com/go-git/go-git/v6"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.0.0-alpha.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-71557"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-08-07T16:41:51Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Impact\nA path traversal issue in `go-git` could allow malicious reference names to access files outside the repository\u0027s intended reference storage.\n\nLoose references are stored under `.git/\u003creference-name\u003e`. 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. \ud83d\ude47",
"id": "GHSA-qgq7-7hm3-q39j",
"modified": "2026-08-07T16:41:51Z",
"published": "2026-08-07T16:41:51Z",
"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"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "go-git: Malicious reference names may modify files outside the reference storage"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.