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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.5
- **CVSS:** 8.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Changed (impact reaches other components); Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 2.22% (percentile 83, 2026-11-26)
- **CWE:** CWE-787, CWE-122
- **Published:** 2022-10-19T00:00:00.000Z
- **Modified:** 2026-06-17T04:58:01.303Z

## Who should check

- Anyone running git \< 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

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

## Affected and fixed versions

- git: \< 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 (cvelist)

## Mitigation

- Upgrade git to 2.37.4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-39260. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-39260.md
Affected: git < 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
Fixed in: git 2.30.6, git 2.31.5, git 2.32.4, git 2.33.5, git 2.34.5, git 2.35.5, git 2.36.3, git 2.37.4

Steps:
1. Search this machine and project for git: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-39260 being exploited?

There is no confirmed exploitation: CVE-2022-39260 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 2.22% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-39260?

High: CVSS 8.5 (v3.1, scored by CNA). Remote, login needed. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2022-39260?

git \< 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.

### Is there a fix for CVE-2022-39260?

Yes. Fixed in git 2.30.6, git 2.31.5, git 2.32.4, git 2.33.5, git 2.34.5, git 2.35.5, git 2.36.3, git 2.37.4. Upgrade git to 2.37.4 or later.

### How do I check if I'm affected by CVE-2022-39260?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/git/git/security/advisories/GHSA-rjr6-wcq6-83p6>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UKFHE4KVD7EKS5J3KTDFVBEKU3CLXGVV/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OHNO2FB55CPX47BAXMBWUBGWHO6N6ZZH/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C7B6JPKX5CGGLAHXJVQMIZNNEEB72FHD/>
- vendor: <https://security.gentoo.org/glsa/202312-15>
- other: <https://support.apple.com/kb/HT213496>
- other: <http://seclists.org/fulldisclosure/2022/Nov/1>
- other: <https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-39260>

HTML: <https://flawdb.com/CVE-2022-39260> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-39260>
