CVE-2022-39260

Git vulnerable to Remote Code Execution via Heap overflow in `git shell`

Published Oct 19, 2022 CVSS 3.1 · 8.5 High EPSS 4.0% KEV · Not listed
Description
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-3239-1 git security update
Debian DLA Debian DLA DLA-3239-2 git regression update
Debian DSA Debian DSA DSA-5332-1 git security update
EUVD EUVD EUVD-2022-41771 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.
Ubuntu USN Ubuntu USN USN-5686-1 Git vulnerabilities
Ubuntu USN Ubuntu USN USN-5686-2 Git vulnerability
Ubuntu USN Ubuntu USN USN-5686-3 Git vulnerabilities
History

No history.

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 3, 2024, 12:00 PM
Reserved
Sep 2, 2022, 12:00 AM
Status
Modified
Published
Oct 19, 2022, 12:15 PM
Modified
Jun 17, 2026, 4:58 AM
Severity
Moderate
Public date
Oct 18, 2022, 12:00 AM