GitPython: Unguarded git read-tree option forwarding
Affects GitPythonSource GCVE Database
CVSS 8.1 High : upgrade to 3.1.58 soon.
Data as of 26 Oct 2026, 16:15 UTC
- Patch
- Available – fixed in 3.1.58
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:HWhat to do
Upgrade GitPython to 3.1.58.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| PyPIGitPython | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A patch is available for this vulnerability. The recommended remediation is to apply the official fix that adds checks for unsafe options and/or inserts a '--' separator before positional treeish arguments in the affected methods to prevent injection of the '--index-output' option. Until patched, avoid passing untrusted input to IndexFile.from_tree, reset, or merge_tree methods. Check the vendor advisory or GitPython repository for the latest patched versions and upgrade accordingly.
Description
GitPython versions up to 3.1.57 contain a vulnerability in the IndexFile.from_tree, reset, and merge_tree methods where unguarded forwarding of git read-tree options allows an attacker to overwrite arbitrary files. The flaw arises because these methods append caller-controlled treeish strings to git read-tree commands without proper unsafe option checks or separators, enabling injection of the --index-output option to specify arbitrary file paths. This leads to arbitrary file overwrite with a valid git-index blob, potentially destroying or corrupting files accessible by the host process.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-4gmw-gg2m-w46p (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2204 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/9b5dcaf85da5946dbf69dcd53f9edba08f760b32 (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.58 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-76219 (opens in a new tab)
- vulncheck.com/advisories/gitpython-before-arbitrary-file-overwrite-via-read-tree (opens in a new tab)