CVE-2026-76219: GitPython before 3.1.58 Arbitrary File Overwrite via read-tree

Published Aug 7, 2026
·
Updated

Summary IndexFile.fromtree, IndexFile.reset (→ fromtree) and IndexFile.mergetree append caller-influenced treeish strings positionally to git read-tree with no unsafe-option guard, no allowunsafeoptions parameter, and no -- separator. git read-tree --index-output=<file> writes the resulting index to an arbitrary path, and last-occurrence-wins lets an injected --index-output override the method's internal temp path — clobbering an arbitrary file with a valid git-index blob. This is a distinct, never-guarded sink: commit 3af0c251 (GHSA-3f7w-8rr8-f37f) guarded only checkoutindex and tag; readtree was left unprotected (it is among the acknowledged unguarded call sites in that advisory's sweep but was never reported or fixed).

Root Cause fromtree (index/base.py:388), reset (delegates to fromtree), and mergetree (index/base.py:291) call repo.git.readtree(arglist) with no checkunsafeoptions and no --. The treeish is caller-influenced and positional.

Impact Arbitrary file overwrite / destruction at the privileges of the host process. Content is constrained to a git-index blob (not attacker-chosen, so not RCE), but the target path is fully attacker-controlled — corrupting/truncating configs or destroying files at attacker-chosen writable locations = I:H + A:H (per the skill's "overwrite-any-path = I:H" rule). Pure VALUE control (positional treeish). Default configuration.

Proof of Concept python IndexFile.fromtree(repo, "--index-output=/home/victim/.bashrc") target overwritten with a valid git-index blob (DIRC...)

Attack Chain 1. Entry: app calls IndexFile.fromtree(repo, treeish) / reset(commit=…) / mergetree(base=…, rhs=…) with attacker treeish="--index-output=/home/victim/.bashrc". 2. Check: NONE — the methods have no allowunsafeoptions and never call checkunsafeoptions. 3. Sink: repo.git.readtree(arglist) — no --. argv (fromtree, observed): ['git','read-tree','--index-output=<tmp>','--index-output=/…/victim'] (last-wins). 4. Impact: target path created/overwritten with a valid git-index blob; existing content destroyed.

Bypass Evidence Independently reproduced (gate harness): IndexFile.fromtree(repo,'--index-output=<victim>') → victim overwritten; before=IMPORTANT ORIGINAL CONTENT, after starts DIRC\x00\x00\x00\x02… (destructive clobber, valid index blob). reset(commit=…) and both mergetree positionals verified. Fix-commit read: 3af0c251 touched only checkoutindex+tag; readtree untouched on HEAD.

Affected Versions GitPython <= 3.1.57 (sinks present verbatim on the latest release tag).

Suggested Fix Add a checkunsafeoptions guard (with an allowunsafeoptions parameter) to fromtree/reset/mergetree, and/or place a -- separator before the positional treeish arguments; block --index-output (a path-taking option) on this sink.

Other sources

GitPython versions before 3.1.58 contain an arbitrary file overwrite vulnerability in IndexFile.fromtree, IndexFile.reset, and IndexFile.mergetree 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.

— NVD

Affected Software

17 affected componentsFixes available
GitPython GitPython<3.1.58
Gitpython Project Gitpython Python<3.1.58
debian/python-git<3.1.30-1+deb12u3
3.1.30-1+deb12u3
debian/python-git<3.1.44-1+deb13u1
3.1.44-1+deb13u1
debian/python-git<3.1.61-1
3.1.61-1
alpine/py3-gitpython<3.1.61-r0
3.1.61-r0
IBM Concert Software<=1.0-3.0.1.1
pip/gitpython<=3.1.57
3.1.58
debian/python-git<=3.1.30-1+deb12u2
3.1.30-1+deb12u33.1.44-1+deb13u13.1.61-1
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.30-1+deb12u3
  2. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.44-1+deb13u1
  3. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.61-1
  4. Upgrade

    Upgrade alpine/py3-gitpython to a version that resolves this vulnerability.

    Fixed in 3.1.61-r0
  5. Upgrade

    Upgrade pip/GitPython to a version that resolves this vulnerability.

    Fixed in 3.1.58
  6. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.30-1+deb12u3Fixed in 3.1.44-1+deb13u1Fixed in 3.1.61-1
  7. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 3.1.58

Event History

Aug 7, 2026
Advisory Published
via GitHub·03:33 PM
Data Sourced
via GitHub·03:33 PM
DescriptionSeverityWeaknessAffected Software
Aug 19, 2026
CVE Published
via MITRE·02:02 PM
Data Sourced
via MITRE·02:02 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·02:17 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·02:17 PM
DescriptionSeverityWeakness
Event
via NVD·02:17 PM
Sep 3, 2026
Data Sourced
via NVD·03:03 PM
Affected Software
Sep 8, 2026
Updated
via GitHub·08:54 PM
Description
Oct 8, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Oct 29, 2026
Updated
via IBM·12:00 AM
Affected Software
Oct 31, 2026
Updated
via OSV·02:00 PM
Affected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

Who is exposed to this issue?

Applications using GitPython versions before 3.1.58 are exposed if they call IndexFile.from_tree, IndexFile.reset, or IndexFile.merge_tree with treeish strings influenced by a lower-privileged attacker.

2

What does an attacker need to exploit it?

The attacker needs the ability to influence a treeish string passed to one of the affected methods. They can inject the --index-output option and target a path that is writable in the context of the affected application.

3

What is the impact of successful exploitation?

Successful exploitation can overwrite an arbitrary writable file with a valid Git index blob. This destroys the existing contents of the targeted file and can affect integrity and availability.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203