CVE-2020-27955: Github.com/git lfs/git lfs Git LFS Can Execute A Vulnerability

CRITICAL
Advisory Identifier: GHSA-4g4p-42wc-9f3m
CVSS 9.8
CWE-427
Published
Advisory Summary

CVE-2020-27955 is a CRITICAL (CVSS 9.8) git lfs can execute a vulnerability (CWE-427: Uncontrolled Search Path Element) 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. Remediation is available by upgrading affected packages to version 2.12.1.

CVE-2020-27955 at a Glance

CVE Identifier CVE-2020-27955
GHSA Identifier GHSA-4g4p-42wc-9f3m
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-427: Uncontrolled Search Path Element
Affected Product Github.com/git lfs/git lfs
Package Ecosystem Go
Published Date
Last Updated

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2020-27955

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.12.1
Upgrade github.com/git-lfs/git-lfs to 2.12.1
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-2020-27955, 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.12.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-427: Uncontrolled Search Path Element, where the product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors. 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 occurs because on Windows, Go includes (and prefers) the current directory when the name of a command run does not contain a directory separator. ### Patches This version should be patched in v2.12.1, which will be released in coordination with this security advisory. ### Workarounds Other than avoiding untrusted repositories, there is no workaround. ### 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-2020-27955 Affected Github.com/git lfs/git lfs Versions

1 component(s)
Fixed Versions:
2.12.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/git-lfs/git-lfs
Go
< 2.12.1
2.12.1

References

Frequently Asked Questions

What is CVE-2020-27955?
CVE-2020-27955 is a security vulnerability in Github.com/git lfs/git lfs involving Git LFS can execute a Git binary from the current directory under CWE-427: Uncontrolled Search Path Element.
Which Github.com/git lfs/git lfs versions are affected?
Affected versions include releases prior to 2.12.1 across affected packages: github.com/git-lfs/git-lfs.
What version fixes CVE-2020-27955?
Upgrading to 2.12.1 (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.12.1. Upgrade your dependency to 2.12.1 or later.
What is the CVSS score of CVE-2020-27955?
CVE-2020-27955 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-27955?
CVE-2020-27955 is classified under CWE-427: Uncontrolled Search Path Element (The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.).
How can I check Go dependencies for CVE-2020-27955?
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-4g4p-42wc-9f3m",
  "modified" : "2022-04-20T16:25:04Z",
  "published" : "2022-02-11T23:39:18Z",
  "aliases" : [ "CVE-2020-27955" ],
  "summary" : "Git LFS can execute a Git binary from the current directory",
  "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 occurs because on Windows, Go includes (and prefers) the current directory when the name of a command run does not contain a directory separator.\n\n### Patches\nThis version should be patched in v2.12.1, which will be released in coordination with this security advisory.\n\n### Workarounds\nOther than avoiding untrusted repositories, there is no workaround.\n\n### For more information\nIf you have any questions or comments about this advisory:\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`.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/git-lfs/git-lfs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.12.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/git-lfs/git-lfs/security/advisories/GHSA-4g4p-42wc-9f3m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-27955"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/git-lfs/git-lfs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/git-lfs/git-lfs/releases"
  }, {
    "type" : "WEB",
    "url" : "https://legalhackers.com/advisories/Git-LFS-RCE-Exploit-CVE-2020-27955.html"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2020/Nov/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-427" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-21T22:10:31Z",
    "nvd_published_at" : "2020-11-05T15:15:00Z"
  }
}