Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply crafted treeish string with --index-output
-
DeliveryPass to IndexFile.from_tree / reset / merge_tree
-
ExploitGitPython invokes git read-tree without -- separator
-
Executiongit last-occurrence-wins overrides library temp path
-
ImpactTarget file overwritten with git-index blob
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Argument sanitization
|
| Exploitation Conditions | The vulnerable application must invoke at least one of three specific GitPython methods - IndexFile.from_tree, IndexFile.reset, or IndexFile.merge_tree - and must forward attacker-controlled input as the treeish positional argument (first argument to from_tree or merge_tree, or the commit keyword argument to reset). The CVSS 4.0 PR:L metric confirms that some form of low-privilege access or authentication to the application is required to supply that input; unauthenticated exploitation (PR:N) is not reflected in the provided vector. The target file path must be writable by the OS user account running the host process - files owned by root or other users are not reachable unless the process runs with elevated privileges. No special git configuration, repository state, or non-default GitPython settings are required; the vulnerability is present in default usage of the three methods. The impact is bounded to overwriting file content with DIRC-format git-index data; arbitrary byte injection into the written file is not possible, ruling out direct code execution via file content manipulation. Applications that never pass user-controlled strings to these three methods are not exploitable regardless of GitPython version. |
| Impact | The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:H) scores 7.2 and indicates network-reachable exploitation requiring only low privileges with no attack complexity or additional preconditions. Real-world exploitability is conditional on an application-layer requirement: the vulnerable code path is only reachable when an application passes attacker-influenced data as the treeish argument to one of the three named methods - a non-trivial precondition that limits exposure to code hosting platforms, CI/CD pipelines, or web tools that accept user-supplied git references and route them through these index operations. The integrity ceiling is bounded: written content is constrained to a valid git-index blob (DIRC magic bytes), not arbitrary attacker-chosen bytes, which rules out direct RCE via content injection; however, destroying or corrupting files such as SSH authorized_keys, cron jobs, application configs, or pip constraints files remains a high-impact outcome. The publicly available proof-of-concept (independently reproduced per the advisory) substantially lowers the exploitation bar. EPSS data was not provided in the available intelligence feed. The combination of a public POC, a simple one-argument injection, and high-value writable-file targets makes this a genuine priority for any Python application that exposes GitPython index operations to external input - but deployments where treeish arguments are always internally generated carry minimal incremental risk. |
| Exploit ScenarioDerived | An attacker authenticated to a code-review or CI web application that accepts a user-supplied branch or commit reference submits the string --index-output=/home/app/.ssh/authorized_keys as the treeish parameter. The application passes this directly to IndexFile.from_tree(repo, user_input); GitPython appends it to the git read-tree argument list without sanitization, and git's last-occurrence-wins behavior causes the injected --index-output to override the library's internal temp path, overwriting authorized_keys with a git-index blob and locking the process owner out of SSH access. A proof-of-concept confirming this exact behavior - before content reading IMPORTANT ORIGINAL CONTENT, after content starting with DIRC bytes - is documented in GHSA-4gmw-gg2m-w46p. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 19, 2026
Arbitrary file overwrite in GitPython before 3.1.58 allows attackers who can influence treeish arguments passed to IndexFile.from_tree, IndexFile.reset, or IndexFile.merge_tree to clobber any file writable by the host process with a valid git-index blob. The three affected methods in git/index/base.py forward caller-controlled strings directly to git read-tree with no option sanitization and no -- argument terminator, enabling injection of --index-output=<path>; git's last-occurrence-wins behavior lets the injected flag override the library's internal temp path. A proof-of-concept is publicly documented in GHSA-4gmw-gg2m-w46p; no CISA KEV listing was present at time of analysis.
RemediationAI
Upgrade GitPython to version 3.1.58 or later, which introduces option validation and an argument separator in the affected index methods. The upstream fix is documented in pull request https://github.com/gitpython-developers/GitPython/pull/2204 and patch commit https://github.com/gitpython-developers/GitPython/commit/9b5dcaf85da5946dbf69dcd53f9edba08f760b32. For applications that cannot immediately upgrade, the primary compensating control is to validate all treeish arguments before they reach IndexFile.from_tree, IndexFile.reset, or IndexFile.merge_tree - specifically, enforce an allowlist of acceptable formats (e.g., 40-character hex SHA-1 strings, or known branch/tag names matched against refs), which is more robust than a denylist of option prefixes such as -- that may be bypassed by encoding. A secondary defense is to run the host process under an OS user with minimal filesystem write permissions, restricting the set of writable paths and thereby limiting the blast radius of a successful injection to only those locations. Note that denylist-only validation (rejecting strings containing --index-output) is a weaker control and should not be relied upon as the sole mitigation.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
GitPython (cpe:2.3:a:gitpython-developers:gitpython:*:*:*:*:*:*:*:*) is a Python library providing an object model for git repositories. The root cause is CWE-88 (Argument Injection or Modification): IndexFile.from_tree (git/index/base.py:388), IndexFile.merge_tree (git/index/base.py:291), and IndexFile.reset (which delegates to from_tree) each construct argument lists for an internal repo.git.read_tree() call by appending caller-supplied treeish strings positionally, with no invocation of check_unsafe_options and no -- separator to terminate git option processing. The git read-tree command natively supports --index-output=<path>, which redirects the serialized index to an arbitrary filesystem path rather than the default location. Because git processes duplicate flags last-occurrence-wins, an injected --index-output embedded in the treeish string overrides the library's own --index-output temp-file argument, writing a valid DIRC-format git-index blob to the attacker-specified path. A prior fix (commit 3af0c251, GHSA-3f7w-8rr8-f37f) hardened only checkout_index and tag; the advisory for that issue acknowledged read_tree as an unguarded call site, but it was never patched until CVE-2026-76219.
Know when Gitpython gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N
PR:L reflects authentication required to supply treeish input; S:U because overwrite is bounded to the host process's own writable filesystem scope; C:N as no data is exfiltrated.
AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
2DescriptionCVE.org
GitPython versions before 3.1.58 contain an arbitrary file overwrite vulnerability in IndexFile.from_tree, IndexFile.reset, and IndexFile.merge_tree methods that append caller-influenced treeish strings to git read-tree without option validation or argument separation. Attackers can inject the --index-output option to overwrite arbitrary files with a valid git-index blob, destroying existing file content at attacker-controlled writable paths.
Blast Radius
ecosystem impact- 16 pypi packages depend on gitpython (15 direct, 1 indirect)
Ecosystem-wide dependent count for version 3.1.58.
Executive ViewAI
GitPython versions before 3.1.58 enable arbitrary file overwrite attacks with publicly available exploit code, affecting any organization deploying this library in production systems. The risk is heightened for CI/CD environments where the library has broad file system access. No vendor patch is currently available, requiring immediate compensating controls.
No vendor-released patch identified at time of analysis. Interim mitigations include: enforce strict input validation and sanitization on all arguments passed to affected methods (IndexFile.from_tree, IndexFile.reset, IndexFile.merge_tree); operate GitPython-dependent services with minimal file system permissions; restrict which user accounts and processes can invoke these functions; implement real-time file integrity monitoring on sensitive system directories; and segment networks to contain blast radius if a compromised system attempts exploitation.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
All versions of package gitpython are vulnerable to Remote Code Execution (RCE) due to improper user input validation, w
Arbitrary code execution in GitPython before 3.1.59 arises from unsafe re-serialization of multi-line, quoted git-config
Arbitrary directory creation and potential hook-based code execution in GitPython affects all releases before 3.1.59. Th
GitPython before 3.1.59 discloses local file content through exception messages when parsing .gitmodules files that cont
GitPython is a python library used to interact with Git repositories. Rated high severity (CVSS 7.8), this vulnerability
Arbitrary file read in GitPython before 3.1.59 allows low-privileged remote attackers to exfiltrate sensitive files by s
Arbitrary file read in GitPython versions before 3.1.59 exposes sensitive filesystem content to low-privileged network a
GitPython is a python library used to interact with Git repositories. Rated medium severity (CVSS 6.5), this vulnerabili
GitPython before 3.1.32 does not block insecure non-multi options in clone and clone_from. Rated critical severity (CVSS
Command execution in GitPython 3.1.50 arises because its default unsafe-option gate fails to recognize joined short-opti
Command injection in GitPython before 3.1.51 allows low-privileged attackers to bypass the `check_unsafe_options` blockl
Command injection in GitPython 3.1.30-3.1.46 allows remote authenticated attackers to execute arbitrary commands via und
Same technique Code Injection
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| openSUSE Tumbleweed | Fixed |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Server 16.0 | Affected |
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.0 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
| openSUSE Leap 16.0 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP4 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP5 | Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Manager Proxy 4.3 | Affected |
| SUSE Manager Retail Branch Server 4.3 | Affected |
| SUSE Manager Server 4.3 | Affected |
| SUSE Linux Enterprise Desktop 15 SP4 | Affected |
| SUSE Linux Enterprise Desktop 15 SP5 | Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Affected |
| openSUSE Leap 15.4 | Affected |
| openSUSE Leap 15.5 | Affected |
| openSUSE Leap 15.6 | Affected |
EUVD-2026-62460
GHSA-7jx3-jqcp-hhgc
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB