Arbitrary Heap Write in Git Shell (CVE-2022-39260)

git Updated 02 Oct 2025

Summary

19/10/2022
N/A
Yes i
High
8.8

CVE-2022-39260: Git is an open source, scalable, distributed revision control system. Affects git across 3 version ranges.

< 2.30.6-r0 >= 853373155dce195a91e6e41a58c8b8e5c5a94652, < 2d2fc8ce733f75f497faabab85c273658c9a5f81 < abd4d67ab0f84fff703fa14d9eebfd287b42daeb

Fixed in 2.30.6-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Git is an open source, scalable, distributed revision control system. It provides version control for software development projects, allowing multiple developers to collaborate on a codebase. Git Shell is a restricted login shell that enables Git's push/pull functionality via SSH. It is used to securely interact with remote Git repositories. However, a vulnerability in Git Shell 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 allows for arbitrary heap writes, potentially leading to remote code execution.

Vulnerability Detail

The vulnerability arises from an improper use of an 'int' to represent the number of entries in an array during the command argument splitting process. This allows a malicious actor to intentionally overflow the return value, leading to arbitrary heap writes. By leveraging this attack, an attacker can gain remote code execution on a victim machine. It's important to note that the victim must have allowed access to Git Shell as a login shell to be vulnerable. The vulnerability has been assigned the CVE identifier CVE-2022-39260 and has a CVSS score of 8.8.

How To Fix

Minimum fixed version

2.30.6-r0

This is the first release that contains the fix.

sudo apk add --upgrade git

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a short-term workaround, users can disable Git Shell access via remote logins. This can be achieved by modifying the system configuration to disallow Git Shell as a login shell for remote users. However, this workaround may impact the ability to use Git's push/pull functionality via SSH. It is recommended to apply the fix by upgrading to the latest version of Git Shell as soon as possible.

Conclusion

The vulnerability in Git Shell (CVE-2022-39260) allows for arbitrary heap writes, potentially leading to remote code execution. Users are advised to upgrade to the latest version of Git Shell to fix the vulnerability. Disabling Git Shell access via remote logins can serve as a short-term workaround. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for git →

Share this vulnerability

FAQ

Git Shell is a restricted login shell that allows users to interact with remote Git repositories securely. It provides the push/pull functionality via SSH.

The vulnerability arises from an improper use of an 'int' to represent the number of entries in an array during the command argument splitting process. This allows for an intentional overflow and arbitrary heap writes.

The vulnerability can lead to remote code execution on a victim machine if the attacker can gain access to Git Shell as a login shell. This can result in unauthorized access, data breaches, or other malicious activities.

To fix this vulnerability, upgrade to the latest version of Git Shell (2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, or 2.37.4). Follow the official Git documentation or package manager instructions for the upgrade process.

Yes, as a short-term workaround, you can disable Git Shell access via remote logins. Modify the system configuration to disallow Git Shell as a login shell for remote users. However, this may impact the ability to use Git's push/pull functionality via SSH.

Related vulnerabilities

Recent vulnerabilities recorded for git.

How To Fix

Minimum fixed version

2.30.6-r0

This is the first release that contains the fix.

sudo apk add --upgrade git

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback