CVE-2026-45571: go-git Crafted Repositories May Modify Main Vulnerability
MODERATECVE-2026-45571 is a MODERATE (CVSS 5.4) crafted repositories may modify main 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 crafted repositories may modify main and submodule .git directories. Remediation is available by upgrading affected packages to version 5.19.1, 6.0.0-alpha.4.
CVE-2026-45571 at a Glance
Security Impact
CVSS: 5.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L).
How to Fix CVE-2026-45571
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.1
Upgrade github.com/go-git/go-git/v6 to 6.0.0-alpha.4
Upgrade github.com/go-git/go-git to Latest secure release
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-45571, 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.1), 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-45571 Affected go-git Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/go-git/go-git/v5
|
Go |
< 5.19.1
|
5.19.1
|
|
github.com/go-git/go-git/v6
|
Go |
< 6.0.0-alpha.4
|
6.0.0-alpha.4
|
|
github.com/go-git/go-git
|
Go |
≤ 44.7.0
|
|
References
Frequently Asked Questions
What is CVE-2026-45571?
Which go-git versions are affected?
What version fixes CVE-2026-45571?
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-45571?
What CWE is associated with CVE-2026-45571?
How can I check Go dependencies for CVE-2026-45571?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-crhj-59gh-8x96",
"modified" : "2026-06-08T23:43:04Z",
"published" : "2026-05-19T15:38:39Z",
"aliases" : [ "CVE-2026-45571" ],
"summary" : "go-git: Crafted repositories may modify main and submodule .git directories",
"details" : "### Impact\nA 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.\n\nThese 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.\n\nUsing 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.\n\nHowever, 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.\n\nIt 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.\n\n### Patches\nUsers 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.\n\n### Credits\nThanks to @kodareef5, @AyushParkara and @N0zoM1z0 for reporting this to the go-git project in three separate reports. 🙇",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git/v5"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.19.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.19.0"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git/v6"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.0-alpha.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 6.0.0-alpha.3"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "44.7.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/security/advisories/GHSA-crhj-59gh-8x96"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-45571"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/go-git/go-git"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-19T15:38:39Z",
"nvd_published_at" : "2026-05-27T15:16:30Z"
}
}