{"id":"CVE-2022-39260","published":"2022-10-19T00:00:00Z","modified":"2024-08-03T12:00:43Z","title":"Git vulnerable to Remote Code Execution via Heap overflow in `git shell`","vendor":"git","product":"git","tier":"tail","description":{"text":"Git is an open source, scalable, distributed revision control system. `git shell` is a restricted login shell that can be used to implement Git's push/pull functionality via SSH. In 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, the function that splits the command arguments into an array improperly uses an `int` to represent the number of entries in the array, allowing a malicious actor to intentionally overflow the return value, leading to arbitrary heap writes. Because the resulting array is then passed to `execv()`, it is possible to leverage this attack to gain remote code execution on a victim machine. Note that a victim must first allow access to `git shell` as a login shell in order to be vulnerable to this attack. This problem is patched in versions 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 and users are advised to upgrade to the latest version. Disabling `git shell` access via remote logins is a viable short-term workaround.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.03987,"percentile":0.90755,"provenance":"source"},"cwes":[{"id":"CWE-787","name":"Out-of-bounds Write"},{"id":"CWE-122","name":"Heap-based Buffer Overflow"}],"references":[{"url":"https://github.com/git/git/security/advisories/GHSA-rjr6-wcq6-83p6","tags":[]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UKFHE4KVD7EKS5J3KTDFVBEKU3CLXGVV/","tags":["vendor-advisory"]},{"url":"https://support.apple.com/kb/HT213496","tags":[]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OHNO2FB55CPX47BAXMBWUBGWHO6N6ZZH/","tags":["vendor-advisory"]},{"url":"http://seclists.org/fulldisclosure/2022/Nov/1","tags":["mailing-list"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C7B6JPKX5CGGLAHXJVQMIZNNEEB72FHD/","tags":["vendor-advisory"]},{"url":"https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html","tags":["mailing-list"]},{"url":"https://security.gentoo.org/glsa/202312-15","tags":["vendor-advisory"]}],"priority":{"score":24.1,"factors":[{"name":"EPSS percentile","points":18.15},{"name":"CVSS severity","points":5.95}]},"vendorSlug":"git","affectedVersions":[{"vendor":"git","product":"git","versions":["< 2.30.6","> 2.31.0, < 2.31.5","> 2.32.0, < 2.32.4","> 2.33.0, < 2.33.5","> 2.34.0, < 2.34.5","> 2.34.0, < 2.35.5","> 2.35.0, < 2.36.3","> 2.37.0, < 2.37.4"]}],"summary":{"text":"Git's git shell, the restricted login shell used to provide SSH-based push and pull, contains a flaw in its command-argument splitting function, which uses an int to count array entries and can be overflowed. An attacker with network access and low-privilege authentication, against a host that has allowed git shell as a login shell, can craft input that overflows the count and writes arbitrary data to the heap, which is then passed to execv() to achieve remote code execution.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T06:37:15Z"},"euvd":{"id":"EUVD-2022-41771","exploited":false,"provenance":"source"}}