CVE-2025-21613: Gopkg.in/src d/go git.v4 Go-git Has An Argument Injection Vulnerability
CRITICALCVE-2025-21613 is a CRITICAL (CVSS 9.8) go-git has an argument injection vulnerability (CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) affecting Gopkg.in/src d/go git.v4 libraries in the Go ecosystem. The issue involves go-git has an argument injection via the url field. Remediation is available by upgrading affected packages to version 5.13.0.
CVE-2025-21613 at a Glance
Security Impact
CVSS: 9.8
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:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2025-21613
To remediate this vulnerability, upgrade all affected Gopkg.in/src d/go git.v4 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 gopkg.in/src-d/go-git.v4 to Latest secure release
Upgrade github.com/go-git/go-git/v5 to 5.13.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for gopkg.in/src-d/go-git.v4
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-21613, inspect your project dependencies for Gopkg.in/src d/go git.v4:
inspect dependencies for gopkg.in/src-d/go-git.v4
Analyze the terminal output to locate any version of Gopkg.in/src d/go git.v4 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.13.0), 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-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), where the product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. In Gopkg.in/src d/go git.v4, 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-2025-21613 Affected Gopkg.in/src d/go git.v4 Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
gopkg.in/src-d/go-git.v4
|
Go |
≥ 4.0.0
≤ 4.13.1
|
|
|
github.com/go-git/go-git/v5
|
Go |
< 5.13.0
|
5.13.0
|
References
Frequently Asked Questions
What is CVE-2025-21613?
Which Gopkg.in/src d/go git.v4 versions are affected?
What version fixes CVE-2025-21613?
Is gopkg.in/src-d/go-git.v4 affected?
Is github.com/go-git/go-git/v5 affected?
What is the CVSS score of CVE-2025-21613?
What CWE is associated with CVE-2025-21613?
How can I check Go dependencies for CVE-2025-21613?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v725-9546-7q7m",
"modified" : "2025-01-06T18:43:12Z",
"published" : "2025-01-06T16:16:30Z",
"aliases" : [ "CVE-2025-21613" ],
"summary" : "go-git has an Argument Injection via the URL field",
"details" : "### Impact\nAn argument injection vulnerability was discovered in `go-git` versions prior to `v5.13`. \n\nSuccessful exploitation of this vulnerability could allow an attacker to set arbitrary values to [git-upload-pack flags](https://git-scm.com/docs/git-upload-pack). This only happens when the `file` transport protocol is being used, as that is the only protocol that shells out to `git` binaries.\n\n### Affected versions\nUsers running versions of `go-git` from `v4` and above are recommended to upgrade to `v5.13` in order to mitigate this vulnerability.\n\n### Workarounds\nIn cases where a bump to the latest version of `go-git` is not possible, we recommend users to enforce restrict validation rules for values passed in the URL field.\n\n## Credit\nThanks to @vin01 for responsibly disclosing this vulnerability to us.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:Clear"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "gopkg.in/src-d/go-git.v4"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"last_affected" : "4.13.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/go-git/go-git/v5"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.13.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/go-git/go-git/security/advisories/GHSA-v725-9546-7q7m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-21613"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/go-git/go-git"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-88" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2025-01-06T16:16:30Z",
"nvd_published_at" : "2025-01-06T17:15:47Z"
}
}