CVE-2022-39260
Git vulnerable to Remote Code Execution via Heap overflow in `git shell`
Reported by github_m · Published October 19, 2022
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| gitk | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
| git | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.38.1-1.amzn2.0.1 |
| git-instaweb | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.38.1-1.amzn2.0.1 |
| git-core | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.38.1-1.amzn2.0.1 |
| perl-Git | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
| git-cvs | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
| gitweb | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.38.1-1.amzn2.0.1 |
| git-email | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.38.1-1.amzn2.0.1 |
| git-credential-libsecret | Amazon Linux | 2.38.1-1.amzn2.0.1 |
| perl-Git-SVN | Amazon Linux | 2.38.1-1.amzn2.0.1 |
| git-all | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
| git-svn | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
7 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| git | git | < 2.30.6, > 2.31.0, < 2.31.5, > 2.32.0, < 2.32.4 |
| amazon:2023 | gitk | 0 |
| amazon:2023 | git | 0 |
| amazon:2 | git-instaweb | 0 |
| amazon:2 | git-core | 0 |
| amazon:2023 | perl-Git | 0 |
| amazon:2023 | git-cvs | 0 |
| amazon:2 | git | 0 |
| amazon:2023 | gitweb | 0 |
| amazon:2 | git-email | 0 |
| amazon:2 | git-credential-libsecret | 0 |
| amazon:2 | gitweb | 0 |
| amazon:2023 | git-instaweb | 0 |
| amazon:2 | perl-Git-SVN | 0 |
| amazon:2023 | git-all | 0 |
| amazon:2023 | git-svn | 0 |
| amazon:2023 | git-core | 0 |
| amazon:2023 | git-subtree | 0 |
| amazon:2023 | git-daemon | 0 |
| amazon:2 | git-p4 | 0 |
…and 19 more
Timeline
- Oct 18, 2022 CVE Published
- Oct 22, 2022 EPSS Score (30 in total, the first dated here)
- Mar 10, 2026 Security Advisory (8 in total, the first dated here)
- Jun 17, 2026 Coalition ESS Score
- Nov 22, 2026 Distribution Patch (6 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2022-39260
vulnetix vdb fixes CVE-2022-39260
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2022-39260/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- FEDORA-2022-8b58806840 vendor-advisory
- FEDORA-2022-53aadd995f vendor-advisory
- 20221107 APPLE-SA-2022-11-01-1 Xcode 14.1 mailing-list
- FEDORA-2022-fb088df94c vendor-advisory
- [debian-lts-announce] 20221213 [SECURITY] [DLA 3239-1] git security update mailing-list
- GLSA-202312-15 vendor-advisory