{"id":"CVE-2022-39260","summary":"Git vulnerable to Remote Code Execution via Heap overflow in `git shell`","details":"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.","aliases":["GHSA-rjr6-wcq6-83p6"],"modified":"2026-04-16T04:36:14.727857525Z","published":"2022-10-19T00:00:00Z","related":["ALSA-2023:2319","ALSA-2023:2859","CGA-2q8x-54r9-wgmp","SUSE-SU-2022:3931-1","SUSE-SU-2022:4271-1","SUSE-SU-2023:0418-1","openSUSE-SU-2024:12487-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/39xxx/CVE-2022-39260.json","cwe_ids":["CWE-122","CWE-787"],"cna_assigner":"GitHub_M"},"references":[{"type":"WEB","url":"https://support.apple.com/kb/HT213496"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/39xxx/CVE-2022-39260.json"},{"type":"ADVISORY","url":"https://github.com/git/git/security/advisories/GHSA-rjr6-wcq6-83p6"},{"type":"ADVISORY","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C7B6JPKX5CGGLAHXJVQMIZNNEEB72FHD/"},{"type":"ADVISORY","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OHNO2FB55CPX47BAXMBWUBGWHO6N6ZZH/"},{"type":"ADVISORY","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UKFHE4KVD7EKS5J3KTDFVBEKU3CLXGVV/"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-39260"},{"type":"ADVISORY","url":"https://security.gentoo.org/glsa/202312-15"},{"type":"ARTICLE","url":"http://seclists.org/fulldisclosure/2022/Nov/1"},{"type":"ARTICLE","url":"https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"0"},{"fixed":"abd4d67ab0f84fff703fa14d9eebfd287b42daeb"}],"database_specific":{"versions":[{"introduced":"0"},{"fixed":"2.30.6"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"a5828ae6b52137b913b978e16cd2334482eb4c1f"},{"fixed":"ecf9b4a443ecd2c7dc759e5d18f226694bc3eced"}],"database_specific":{"versions":[{"introduced":"2.31.0"},{"fixed":"2.31.5"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"ebf3c04b262aa27fbb97f8a0156c2347fecafafb"},{"fixed":"af778cd9be6307e34f9f900fd42eb826c65b32da"}],"database_specific":{"versions":[{"introduced":"2.32.0"},{"fixed":"2.32.4"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"225bc32a989d7a22fa6addafd4ce7dcd04675dbf"},{"fixed":"7800e1dccf622ba8d490b4c1c92af734be6242ff"}],"database_specific":{"versions":[{"introduced":"2.33.0"},{"fixed":"2.33.5"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"cd3e606211bb1cf8bc57f7d76bab98cc17a150bc"},{"fixed":"be85cfc4dbef9ffa177770f8607fd4a85445565e"},{"fixed":"868154bb1c08a547afaf74ed8bafdf9bf55d1fd5"}],"database_specific":{"versions":[{"introduced":"2.34.0"},{"fixed":"2.34.5"},{"fixed":"2.35.5"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"89bece5c8c96f0b962cfc89e63f82d603fd60bed"},{"fixed":"fcdaa211e6127eeba69a121844e08aec67da2131"}],"database_specific":{"versions":[{"introduced":"2.35.0"},{"fixed":"2.36.3"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"e4a4b31577c7419497ac30cebe30d755b97752c5"},{"fixed":"83d5e3341b69b3116675f13d2fab208a12c79e27"}],"database_specific":{"versions":[{"introduced":"2.37.0"},{"fixed":"2.37.4"}]}}],"versions":["v0.99","v0.99.1","v0.99.2","v0.99.3","v0.99.4","v0.99.5","v0.99.6","v0.99.7","v0.99.8","v0.99.8a","v0.99.8b","v0.99.8c","v0.99.8d","v0.99.8e","v0.99.8f","v0.99.8g","v0.99.9a","v0.99.9b","v0.99.9c","v0.99.9d","v0.99.9e","v0.99.9f","v0.99.9g","v0.99.9h","v0.99.9i","v0.99.9j","v0.99.9k","v0.99.9l","v0.99.9m","v0.99.9n","v1.0.0","v1.0rc1","v1.0rc2","v1.0rc3","v1.0rc4","v1.0rc5","v1.0rc6","v1.1.0","v1.2.0","v1.3.0-rc1","v1.4.1","v1.4.1-rc1","v1.4.1-rc2","v1.4.2","v1.4.2-rc1","v1.4.2-rc2","v1.4.2-rc3","v1.4.2-rc4","v1.4.3","v1.4.3-rc1","v1.4.3-rc2","v1.4.3-rc3","v1.4.4","v1.4.4-rc1","v1.4.4-rc2","v1.4.4.1","v1.5.0","v1.5.0-rc0","v1.5.0-rc1","v1.5.0-rc2","v1.5.0-rc3","v1.5.0-rc4","v1.5.1","v1.5.1-rc1","v1.5.1-rc2","v1.5.1-rc3","v1.5.2","v1.5.2-rc0","v1.5.2-rc1","v1.5.2-rc2","v1.5.2-rc3","v1.5.3","v1.5.3-rc0","v1.5.3-rc1","v1.5.3-rc2","v1.5.3-rc3","v1.5.3-rc4","v1.5.3-rc5","v1.5.3-rc6","v1.5.3-rc7","v1.5.3.1","v1.5.4","v1.5.4-rc0","v1.5.4-rc1","v1.5.4-rc2","v1.5.4-rc3","v1.5.4-rc4","v1.5.4-rc5","v1.5.5","v1.5.5-rc0","v1.5.5-rc1","v1.5.5-rc2","v1.5.5-rc3","v1.5.6","v1.5.6-rc0","v1.5.6-rc1","v1.5.6-rc2","v1.5.6-rc3","v1.6.0","v1.6.0-rc0","v1.6.0-rc1","v1.6.0-rc2","v1.6.0-rc3","v1.6.1","v1.6.1-rc1","v1.6.1-rc2","v1.6.1-rc3","v1.6.1-rc4","v1.6.2","v1.6.2-rc0","v1.6.2-rc1","v1.6.2-rc2","v1.6.3","v1.6.3-rc0","v1.6.3-rc1","v1.6.3-rc2","v1.6.3-rc3","v1.6.3-rc4","v1.6.4","v1.6.4-rc0","v1.6.4-rc1","v1.6.4-rc2","v1.6.4-rc3","v1.6.5","v1.6.5-rc0","v1.6.5-rc1","v1.6.5-rc2","v1.6.5-rc3","v1.6.6","v1.6.6-rc0","v1.6.6-rc1","v1.6.6-rc2","v1.6.6-rc3","v1.6.6-rc4","v1.7.0","v1.7.0-rc0","v1.7.0-rc1","v1.7.0-rc2","v1.7.1","v1.7.1-rc0","v1.7.1-rc1","v1.7.1-rc2","v1.7.10","v1.7.10-rc0","v1.7.10-rc1","v1.7.10-rc2","v1.7.10-rc3","v1.7.10-rc4","v1.7.11","v1.7.11-rc0","v1.7.11-rc1","v1.7.11-rc2","v1.7.11-rc3","v1.7.12","v1.7.12-rc0","v1.7.12-rc1","v1.7.12-rc2","v1.7.12-rc3","v1.7.2","v1.7.2-rc0","v1.7.2-rc1","v1.7.2-rc2","v1.7.2-rc3","v1.7.3","v1.7.3-rc0","v1.7.3-rc1","v1.7.3-rc2","v1.7.3.1","v1.7.4","v1.7.4-rc0","v1.7.4-rc1","v1.7.4-rc2","v1.7.4-rc3","v1.7.5","v1.7.5-rc0","v1.7.5-rc1","v1.7.5-rc2","v1.7.5-rc3","v1.7.6","v1.7.6-rc0","v1.7.6-rc1","v1.7.6-rc2","v1.7.6-rc3","v1.7.7","v1.7.7-rc0","v1.7.7-rc1","v1.7.7-rc2","v1.7.7-rc3","v1.7.8","v1.7.8-rc0","v1.7.8-rc1","v1.7.8-rc2","v1.7.8-rc3","v1.7.8-rc4","v1.7.9","v1.7.9-rc0","v1.7.9-rc1","v1.7.9-rc2","v1.8.0","v1.8.0-rc0","v1.8.0-rc1","v1.8.0-rc2","v1.8.0-rc3","v1.8.1","v1.8.1-rc0","v1.8.1-rc1","v1.8.1-rc2","v1.8.1-rc3","v1.8.2","v1.8.2-rc0","v1.8.2-rc1","v1.8.2-rc2","v1.8.2-rc3","v1.8.3","v1.8.3-rc0","v1.8.3-rc1","v1.8.3-rc2","v1.8.3-rc3","v1.8.4","v1.8.4-rc0","v1.8.4-rc1","v1.8.4-rc2","v1.8.4-rc3","v1.8.4-rc4","v1.8.5","v1.8.5-rc0","v1.8.5-rc1","v1.8.5-rc2","v1.8.5-rc3","v1.9-rc0","v1.9-rc1","v1.9-rc2","v1.9.0","v1.9.0-rc3","v2.0.0","v2.0.0-rc0","v2.0.0-rc1","v2.0.0-rc2","v2.0.0-rc3","v2.0.0-rc4","v2.1.0","v2.1.0-rc0","v2.1.0-rc1","v2.1.0-rc2","v2.10.0","v2.10.0-rc0","v2.10.0-rc1","v2.10.0-rc2","v2.11.0","v2.11.0-rc0","v2.11.0-rc1","v2.11.0-rc2","v2.11.0-rc3","v2.12.0","v2.12.0-rc0","v2.12.0-rc1","v2.12.0-rc2","v2.13.0","v2.13.0-rc0","v2.13.0-rc1","v2.13.0-rc2","v2.14.0","v2.14.0-rc0","v2.14.0-rc1","v2.15.0","v2.15.0-rc0","v2.15.0-rc1","v2.15.0-rc2","v2.16.0","v2.16.0-rc0","v2.16.0-rc1","v2.16.0-rc2","v2.17.0","v2.17.0-rc0","v2.17.0-rc1","v2.17.0-rc2","v2.18.0","v2.18.0-rc0","v2.18.0-rc1","v2.18.0-rc2","v2.19.0","v2.19.0-rc0","v2.19.0-rc1","v2.19.0-rc2","v2.2.0","v2.2.0-rc0","v2.2.0-rc1","v2.2.0-rc2","v2.2.0-rc3","v2.20.0","v2.20.0-rc0","v2.20.0-rc1","v2.20.0-rc2","v2.21.0","v2.21.0-rc0","v2.21.0-rc1","v2.21.0-rc2","v2.22.0","v2.22.0-rc0","v2.22.0-rc1","v2.22.0-rc2","v2.22.0-rc3","v2.23.0","v2.23.0-rc0","v2.23.0-rc1","v2.23.0-rc2","v2.24.0","v2.24.0-rc0","v2.24.0-rc1","v2.24.0-rc2","v2.25.0","v2.25.0-rc0","v2.25.0-rc1","v2.25.0-rc2","v2.26.0","v2.26.0-rc0","v2.26.0-rc1","v2.26.0-rc2","v2.27.0","v2.27.0-rc0","v2.27.0-rc1","v2.27.0-rc2","v2.28.0","v2.28.0-rc0","v2.28.0-rc1","v2.28.0-rc2","v2.29.0","v2.29.0-rc0","v2.29.0-rc1","v2.29.0-rc2","v2.3.0","v2.3.0-rc0","v2.3.0-rc1","v2.3.0-rc2","v2.30.0","v2.30.0-rc0","v2.30.0-rc1","v2.30.0-rc2","v2.30.1","v2.30.2","v2.30.3","v2.30.4","v2.30.5","v2.31.0","v2.31.1","v2.31.2","v2.31.3","v2.31.4","v2.32.0","v2.32.1","v2.32.2","v2.32.3","v2.33.0","v2.33.1","v2.33.2","v2.33.3","v2.33.4","v2.34.0","v2.34.1","v2.34.2","v2.34.3","v2.34.4","v2.35.0","v2.35.0-rc0","v2.35.0-rc1","v2.35.0-rc2","v2.35.1","v2.35.2","v2.35.3","v2.35.4","v2.36.0","v2.36.0-rc0","v2.36.0-rc1","v2.36.0-rc2","v2.36.1","v2.36.2","v2.37.0","v2.37.1","v2.37.2","v2.37.3","v2.4.0","v2.4.0-rc0","v2.4.0-rc1","v2.4.0-rc2","v2.4.0-rc3","v2.5.0","v2.5.0-rc0","v2.5.0-rc1","v2.5.0-rc2","v2.5.0-rc3","v2.6.0","v2.6.0-rc0","v2.6.0-rc1","v2.6.0-rc2","v2.6.0-rc3","v2.7.0","v2.7.0-rc0","v2.7.0-rc1","v2.7.0-rc2","v2.7.0-rc3","v2.8.0","v2.8.0-rc0","v2.8.0-rc1","v2.8.0-rc2","v2.8.0-rc3","v2.8.0-rc4","v2.9.0","v2.9.0-rc0","v2.9.0-rc1","v2.9.0-rc2"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-39260.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H"}]}