GHSA-3f7w-8rr8-f37f: Arbitrary File Overwrite and Read via Unguarded Argument Forwarding in GitPython
Vulnerability ID: GHSA-3F7W-8RR8-F37F
CVSS Score: 8.1
Published: 2026-08-03
An argument injection vulnerability in GitPython allows remote or local attackers to execute arbitrary file reads or arbitrary file overwrites via unsafe command option forwarding. This occurs because the wrapper methods IndexFile.checkout() and TagReference.create() fail to validate parameters before passing them to system-level git invocations.
TL;DR
GitPython versions prior to 3.1.57 are vulnerable to argument injection, enabling arbitrary file overwrite via IndexFile.checkout() and arbitrary file read via TagReference.create() because keyword arguments are forwarded unsanitized to the underlying git binary.
⚠️ Exploit Status: POC
Technical Details
- CWE ID: CWE-88 (Argument Injection), CWE-20 (Improper Input Validation)
- Attack Vector: Network
- CVSS Score: 8.1
- Impact: High (Arbitrary File Overwrite / Arbitrary File Read)
- Exploit Status: Proof-of-Concept Available
- KEV Status: Not Listed
Affected Systems
- GitPython
-
gitpython: < 3.1.57 (Fixed in:
3.1.57)
Code Analysis
Commit: 3af0c25
Reject unsafe options in IndexFile.checkout and TagReference.create
Mitigation Strategies
- Upgrade GitPython to version 3.1.57 or newer to enforce default parameter validation blocklists.
- Sanitize application-level inputs to ensure keys like 'prefix', 'F', and 'file' are stripped from user-controlled dictionary unpacking before passing arguments to GitPython methods.
- Apply the principle of least privilege by running repository-parsing applications within isolated, non-root user accounts or containerized environments.
Remediation Steps:
- Identify all direct dependencies on GitPython within requirements files or package lock files.
- Execute the package manager update command:
pip install --upgrade gitpython>=3.1.57. - Search the codebase for usages of
IndexFile.checkout()andTagReference.create()to ensure no manual enablement ofallow_unsafe_options=Trueexists without proper sanitization.
References
- GitHub Security Advisory GHSA-3f7w-8rr8-f37f
- GitPython Pull Request 2193
- GitPython Fix Commit
- GitPython Source Repository
- GitPython Release 3.1.57
Read the full report for GHSA-3F7W-8RR8-F37F on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)