CVE-2021-21237: Github.com/git lfs/git lfs Git LFS Can Execute A Vulnerability
HIGHCVE-2021-21237 is a HIGH (CVSS 7.2) git lfs can execute a vulnerability (CWE-426: Untrusted Search Path) affecting Github.com/git lfs/git lfs libraries in the Go ecosystem. The issue involves git lfs can execute a git binary from the current directory on windows. Remediation is available by upgrading affected packages to version 2.13.2.
CVE-2021-21237 at a Glance
Security Impact
CVSS: 7.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2021-21237
To remediate this vulnerability, upgrade all affected Github.com/git lfs/git lfs 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/git-lfs/git-lfs to 2.13.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/git-lfs/git-lfs
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-21237, inspect your project dependencies for Github.com/git lfs/git lfs:
inspect dependencies for github.com/git-lfs/git-lfs
Analyze the terminal output to locate any version of Github.com/git lfs/git lfs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.13.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-426: Untrusted Search Path, where the product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control. In Github.com/git lfs/git lfs, 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-2021-21237 Affected Github.com/git lfs/git lfs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/git-lfs/git-lfs
|
Go |
< 2.13.2
|
2.13.2
|
References
Frequently Asked Questions
What is CVE-2021-21237?
Which Github.com/git lfs/git lfs versions are affected?
What version fixes CVE-2021-21237?
Is github.com/git-lfs/git-lfs affected?
What is the CVSS score of CVE-2021-21237?
What CWE is associated with CVE-2021-21237?
How can I check Go dependencies for CVE-2021-21237?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cx3w-xqmc-84g5",
"modified" : "2022-04-20T16:24:41Z",
"published" : "2022-02-15T00:30:37Z",
"aliases" : [ "CVE-2021-21237" ],
"summary" : "Git LFS can execute a Git binary from the current directory on Windows",
"details" : "### Impact\nOn Windows, if Git LFS operates on a malicious repository with a git.bat or git.exe file in the current directory, that program would be executed, permitting the attacker to execute arbitrary code. This does not affect Unix systems.\n\nThis is the result of an incomplete fix for CVE-2020-27955.\n\nThis issue occurs because on Windows, [Go includes (and prefers) the current directory when the name of a command run does not contain a directory separator](https://github.com/golang/go/issues/38736).\n\n### Patches\nThis version should be patched in v2.13.2, which will be released in coordination with this security advisory.\n\n### Workarounds\nOther than avoiding untrusted repositories or using a different operating system, there is no workaround.\n\n### References\n_Are there any links users can visit to find out more?_\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- Start a discussion in [the Git LFS discussion page](https://github.com/git-lfs/git-lfs/discussions).\n- If you cannot open a discussion, please email the core team using their usernames at `github.com`.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/git-lfs/git-lfs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.13.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/git-lfs/git-lfs/security/advisories/GHSA-cx3w-xqmc-84g5"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21237"
}, {
"type" : "WEB",
"url" : "https://github.com/git-lfs/git-lfs/commit/fc664697ed2c2081ee9633010de0a7f9debea72a"
}, {
"type" : "WEB",
"url" : "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-27955"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/git-lfs/git-lfs"
}, {
"type" : "WEB",
"url" : "https://github.com/git-lfs/git-lfs/releases/tag/v2.13.2"
}, {
"type" : "WEB",
"url" : "https://pkg.go.dev/vuln/GO-2021-0098"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-426", "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-21T17:37:52Z",
"nvd_published_at" : null
}
}