CVE-2021-21237: Github.com/git lfs/git lfs Git LFS Can Execute A Vulnerability

HIGH
Advisory Identifier: GHSA-cx3w-xqmc-84g5
CVSS 7.2
CWE-426 CWE-94
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2021-21237
GHSA Identifier GHSA-cx3w-xqmc-84g5
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-426: Untrusted Search Path
Affected Product Github.com/git lfs/git lfs
Package Ecosystem Go
Published Date
Last Updated

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).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (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.

github.com/git-lfs/git-lfs fixed: 2.13.2
Upgrade github.com/git-lfs/git-lfs to 2.13.2
Verify Direct and Transitive Dependencies

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

### Impact On 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. This is the result of an incomplete fix for CVE-2020-27955. This 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). ### Patches This version should be patched in v2.13.2, which will be released in coordination with this security advisory. ### Workarounds Other than avoiding untrusted repositories or using a different operating system, there is no workaround. ### References _Are there any links users can visit to find out more?_ ### For more information If you have any questions or comments about this advisory: - Start a discussion in [the Git LFS discussion page](https://github.com/git-lfs/git-lfs/discussions). - If you cannot open a discussion, please email the core team using their usernames at `github.com`.

CVE-2021-21237 Affected Github.com/git lfs/git lfs Versions

1 component(s)
Fixed Versions:
2.13.2
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?
CVE-2021-21237 is a security vulnerability in Github.com/git lfs/git lfs involving Git LFS can execute a Git binary from the current directory on Windows under CWE-426: Untrusted Search Path.
Which Github.com/git lfs/git lfs versions are affected?
Affected versions include releases prior to 2.13.2 across affected packages: github.com/git-lfs/git-lfs.
What version fixes CVE-2021-21237?
Upgrading to 2.13.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/git-lfs/git-lfs affected?
Yes, github.com/git-lfs/git-lfs is affected in releases prior to 2.13.2. Upgrade your dependency to 2.13.2 or later.
What is the CVSS score of CVE-2021-21237?
CVE-2021-21237 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2021-21237?
CVE-2021-21237 is classified under CWE-426: Untrusted Search Path (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.).
How can I check Go dependencies for CVE-2021-21237?
Run the dependency tree command: 'inspect dependencies for github.com/git-lfs/git-lfs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}