CVE-2022-39260Git vulnerable to Remote Code Execution via Heap overflow in `git shell`
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.
What to do
Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Ubuntu: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 22.04 | git | Fixed | 1:2.34.1-1ubuntu1.5 | UBUNTU-CVE-2022-39260 |
| Ubuntu 20.04 | git | Fixed | 1:2.25.1-1ubuntu3.6 | UBUNTU-CVE-2022-39260 |
| Ubuntu 18.04 | git | Fixed | 1:2.17.1-1ubuntu0.13 | UBUNTU-CVE-2022-39260 |
| Ubuntu 16.04 | git | Fix pending | 1:2.7.4-0ubuntu1.10+esm3 (Ubuntu Pro) | UBUNTU-CVE-2022-39260 |
| Debian 14 | git | Fixed | 1:2.38.1-1 | DEBIAN-CVE-2022-39260 |
| Debian 13 | git | Fixed | 1:2.38.1-1 | DEBIAN-CVE-2022-39260 |
| Debian 12 | git | Fixed | 1:2.38.1-1 | DEBIAN-CVE-2022-39260 |
| Red Hat Enterprise Linux 9 | git | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-all | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-core | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-core-doc | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-credential-libsecret | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-daemon | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-email | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-gui | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-instaweb | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-subtree | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | git-svn | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | gitk | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | gitweb | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | perl-Git | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 9 | perl-Git-SVN | Fixed | 0:2.39.1-1.el9 | RHSA-2023:2319 |
| Red Hat Enterprise Linux 8 | git | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-all | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-core | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-core-doc | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-credential-libsecret | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-daemon | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-email | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-gui | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-instaweb | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-subtree | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | git-svn | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | gitk | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | gitweb | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | perl-Git | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 8 | perl-Git-SVN | Fixed | 0:2.39.1-1.el8 | RHSA-2023:2859 |
| Red Hat Enterprise Linux 7 | emacs-git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | emacs-git-el | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-all | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-bzr | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-cvs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-daemon | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-email | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-gnome-keyring | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-gui | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-hg | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-instaweb | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-p4 | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | git-svn | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | gitk | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | gitweb | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | perl-Git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | perl-Git-SVN | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | emacs-git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | emacs-git-el | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-all | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-cvs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-daemon | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-email | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-gui | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-svn | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | gitk | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | gitweb | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | perl-Git | Will not fix Out of support scope | ||
| AlmaLinux 9 | git | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-all | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-core | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-core-doc | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-credential-libsecret | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-daemon | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-email | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-gui | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-instaweb | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-subtree | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | git-svn | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | gitk | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | gitweb | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | perl-Git | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 9 | perl-Git-SVN | Fixed | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux 8 | git | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-all | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-core | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-core-doc | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-credential-libsecret | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-daemon | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-email | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-gui | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-instaweb | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-subtree | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | git-svn | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | gitk | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | gitweb | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | perl-Git | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux 8 | perl-Git-SVN | Fixed | 2.39.1-1.el8 | ALSA-2023:2859 |
| Alpine Linux 3.24 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.23 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.22 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.21 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.20 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.19 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.18 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.17 | git | Fixed | 2.38.1-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.16 | git | Fixed | 2.36.3-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.15 | git | Fixed | 2.34.5-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.14 | git | Fixed | 2.32.4-r0 | ALPINE-CVE-2022-39260 |
| Alpine Linux 3.13 | git | Fixed | 2.30.6-r0 | ALPINE-CVE-2022-39260 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- git: affected: < 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
Vendor advisories:
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/… (vendor-advisory)
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/… (vendor-advisory)
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/… (vendor-advisory)
- https://security.gentoo.org/glsa/202312-15 (vendor-advisory)
References
- https://github.com/git/git/security/advisories/GHSA-rjr6-wcq6-83p6
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UKFHE4KVD7EKS5J3KTDFVBEKU3CLXGVV/
- https://support.apple.com/kb/HT213496
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OHNO2FB55CPX47BAXMBWUBGWHO6N6ZZH/
- http://seclists.org/fulldisclosure/2022/Nov/1
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C7B6JPKX5CGGLAHXJVQMIZNNEEB72FHD/
- https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html
- https://security.gentoo.org/glsa/202312-15
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.