CVE-2022-39260 Git vulnerable to Remote Code Execution via Heap overflow in `git shell`

High 8.5 Published Updated

An integer overflow in git shell allows remote code execution if git shell is enabled as a login shell.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-39260?

CVE-2022-39260 is a high-severity vulnerability in Apple Xcode, published on 19 Oct 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official 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.

Weakness: CWE-787, CWE-122

Which versions are affected by CVE-2022-39260?

It affects 4 products.

Products include Apple Xcode, Debian Debian Linux, Fedoraproject Fedora, Git-Scm Git.

How do I fix CVE-2022-39260?

Upgrade to a fixed version.

Is CVE-2022-39260 being exploited?

There is no known exploitation of CVE-2022-39260 in the wild and no public exploit code.

All Apple Xcode vulnerabilities

Sources

Also known as ALPINE-CVE-2022-39260, CLEANSTART-2026-BE06900, DEBIAN-CVE-2022-39260, GHSA-rjr6-wcq6-83p6, UBUNTU-CVE-2022-39260, USN-5686-2.

Is CVE-2022-39260 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free