Arbitrary Heap Write in Git Shell (CVE-2022-39260)
Summary
CVE-2022-39260: Git is an open source, scalable, distributed revision control system. Affects git across 3 version ranges.
< 2.30.6-r0
>= 853373155dce195a91e6e41a58c8b8e5c5a94652, < 2d2fc8ce733f75f497faabab85c273658c9a5f81
< abd4d67ab0f84fff703fa14d9eebfd287b42daeb
Fixed in 2.30.6-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Git is an open source, scalable, distributed revision control system. It provides version control for software development projects, allowing multiple developers to collaborate on a codebase. Git Shell is a restricted login shell that enables Git's push/pull functionality via SSH. It is used to securely interact with remote Git repositories. However, a vulnerability in Git Shell versions prior to 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and 2.37.4 allows for arbitrary heap writes, potentially leading to remote code execution.
Vulnerability Detail
The vulnerability arises from an improper use of an 'int' to represent the number of entries in an array during the command argument splitting process. This allows a malicious actor to intentionally overflow the return value, leading to arbitrary heap writes. By leveraging this attack, an attacker can gain remote code execution on a victim machine. It's important to note that the victim must have allowed access to Git Shell as a login shell to be vulnerable. The vulnerability has been assigned the CVE identifier CVE-2022-39260 and has a CVSS score of 8.8.
How To Fix
Minimum fixed version
2.30.6-r0
This is the first release that contains the fix.
sudo apk add --upgrade git
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a short-term workaround, users can disable Git Shell access via remote logins. This can be achieved by modifying the system configuration to disallow Git Shell as a login shell for remote users. However, this workaround may impact the ability to use Git's push/pull functionality via SSH. It is recommended to apply the fix by upgrading to the latest version of Git Shell as soon as possible.
Conclusion
The vulnerability in Git Shell (CVE-2022-39260) allows for arbitrary heap writes, potentially leading to remote code execution. Users are advised to upgrade to the latest version of Git Shell to fix the vulnerability. Disabling Git Shell access via remote logins can serve as a short-term workaround. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for git →
FAQ
Git Shell is a restricted login shell that allows users to interact with remote Git repositories securely. It provides the push/pull functionality via SSH.
The vulnerability arises from an improper use of an 'int' to represent the number of entries in an array during the command argument splitting process. This allows for an intentional overflow and arbitrary heap writes.
The vulnerability can lead to remote code execution on a victim machine if the attacker can gain access to Git Shell as a login shell. This can result in unauthorized access, data breaches, or other malicious activities.
To fix this vulnerability, upgrade to the latest version of Git Shell (2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, or 2.37.4). Follow the official Git documentation or package manager instructions for the upgrade process.
Yes, as a short-term workaround, you can disable Git Shell access via remote logins. Modify the system configuration to disallow Git Shell as a login shell for remote users. However, this may impact the ability to use Git's push/pull functionality via SSH.
Related vulnerabilities
Recent vulnerabilities recorded for git.