Skip to main content
VulnerabilityPublished Updated

GitPython: Unguarded git read-tree option forwarding

Affects GitPythonSource GCVE Database

0

CVSS 8.1 High : upgrade to 3.1.58 soon.

Data as of 26 Oct 2026, 16:15 UTC

CVSS 3.1 base score
8.1High
How severe the flaw is on the 0–10 CVSS scale.
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:H

What to do

Upgrade GitPython to 3.1.58.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.58
Fixed in
  • 3.1.58

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

Community reviews

Loading reviews…