Skip to content

Arbitrary code execution when checking out an attacker-controlled Git branch

High
me-and published GHSA-rmp3-wq55-f557 Apr 24, 2021

Package

git (Cygwin)

Affected versions

<=2.31.1-1

Patched versions

2.31.1-2

Description

Impact

A specially crafted repository that contains symbolic links as well as files with backslash characters in the file name may cause Git to overwrite arbitrary files when checking out a repository using Git on Cygwin. In particular, this would allow an attacker to execute arbitrary code as soon as the repository is checked out.

Patches

The problem is patched in the Cygwin Git v2.31.1-2 release.

At time of writing, the vulnerability is present in the upstream Git source code; any Cygwin user who compiles Git for themselves from upstream sources should manually apply a patch to mitigate the vulnerability: https://github.com/cygporter/git/blob/v2.31.1-2/check-backslash-safety.patch

Workarounds

You should not clone or pull from repositories from untrusted sources.

References

For more information

If you have any questions or comments about this advisory:

  • For public questions specifically relating to Git on Cygwin, contact the Cygwin mailing list (details at http://cygwin.com/ml)
  • For public questions relating to Git in general, contact the Git mailing list (details at https://git-scm.com/community)
  • To disclose further vulnerabilities privately, contact the Git-security list by emailing [email protected]

Credit

I'd like to thank @Ry0taK for finding and reporting this vulnerability, and @dscho for advice with handling it.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

CVE ID

CVE-2021-29468

Credits