CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-3F7W-8RR8-F37F

GHSA-3f7w-8rr8-f37f: Arbitrary File Overwrite and Read via Unguarded Argument Forwarding in GitPython

Alon Barad
Alon Barad
Software Engineer

Aug 4, 2026·5 min read·51 visits

Executive Summary (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.

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.

Vulnerability Overview

GitPython is a Python library used to interact with Git repositories by abstracting command-line operations into Pythonic APIs. The library provides high-level classes such as IndexFile and TagReference to manage git indexes and reference tags respectively. When these classes perform actions, they serialize programmatic options and dispatch execution to the local system's git binary.

The attack surface exists within any API wrapper that passes developer-controlled keyword arguments directly to the underlying shell command execution. By default, GitPython features an opt-in parameter validation system called Git.check_unsafe_options(). However, because this verification is not enforced globally at the execution dispatcher layer, any API wrapper that omits the validation remains completely unguarded.

Two critical wrapper methods are vulnerable to this design pattern. The IndexFile.checkout() method forwards arguments to git checkout-index, which accepts the --prefix option to redirect file creation outside the workspace. The TagReference.create() method forwards arguments to git tag, which accepts the -F or --file options to read local system files and return them in-band. This leads to arbitrary file write (integrity and availability compromise) and arbitrary file read (confidentiality compromise).

Root Cause Analysis

The root cause of this vulnerability lies in improper validation of command-line arguments, classified under CWE-88 (Argument Injection) and CWE-20 (Improper Input Validation). GitPython relies on individual, opt-in implementations of Git.check_unsafe_options() inside wrapper functions to maintain security. If a wrapper accepts **kwargs and passes them directly to the git command execution without sanitization, an attacker who controls the arguments can inject system flags.

In IndexFile.checkout(), the python method forwards arguments to git checkout-index. The --prefix=<path> command-line option specifies a prefix directory to prepend to checked-out paths. Because there is no check preventing the use of --prefix, an attacker can specify absolute directories or directory traversal sequences. This allows the application to write files from the repository to arbitrary paths on the local filesystem, overwriting existing files if run with appropriate permissions.

In TagReference.create(), the method maps to the git tag command. The command-line utility supports the -F <file> and --file=<file> options to import a tag message from a target file. Because GitPython does not filter these options, an attacker can specify a sensitive system file as the source. GitPython subsequently reads this file, associates it with the created tag object, and exposes its raw contents when the application accesses the TagReference.tag.message property.

Code Analysis

Before the patch, git/index/base.py contained the following unsafe forwarding mechanism:

def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwargs):
    # Unsanitized kwargs are passed directly to checkout_index
    proc = self.repo.git.checkout_index(*args, **kwargs)

Because there is no invocation of Git.check_unsafe_options() or defined blocked option list, any keys in kwargs are converted directly into command-line arguments. For example, passing prefix='/tmp/' evaluates to --prefix=/tmp/ in the shell execution.

Similarly, git/refs/tag.py contained the following definition:

def create(cls, repo, path, reference="HEAD", logmsg=None, force=False, **kwargs):
    # Forwarded directly to the underlying git wrapper without verification
    # kwargs can contain 'F' or 'file' keys

To address this, the patch introduces class-level variables specifying banned options and updates the method signatures to accept allow_unsafe_options: bool = False. Inside the methods, an explicit check validates the passed arguments against the blocklist unless allow_unsafe_options is set to True:

# Inside IndexFile
unsafe_git_checkout_index_options = ["--prefix"]
 
# Validation check added to checkout()
if not allow_unsafe_options:
    Git.check_unsafe_options(
        options=Git._option_candidates([], kwargs),
        unsafe_options=self.unsafe_git_checkout_index_options,
    )

Exploitation and Proof-of-Concept

Exploitation requires the attacker to be able to supply or influence the keyword arguments (**kwargs) passed to either of the vulnerable methods. This scenario typically occurs in web applications, automated CI/CD pipelines, or repository management dashboards that accept custom execution configurations from users.

To perform an arbitrary file overwrite, an attacker invokes index.checkout() with a custom prefix argument pointing to a system target. The following proof-of-concept demonstrates how the exploit redirects repository files to write directly into /tmp/target_dir/ instead of the local repository workspace:

from git import Repo
import os
 
repo = Repo("/path/to/repo")
# Executes 'git checkout-index -a -f --prefix=/tmp/target_dir/'
repo.index.checkout(prefix="/tmp/target_dir/", a=True, f=True)

To perform an arbitrary file read, the attacker targets TagReference.create() by specifying the -F parameter with the target file path. When GitPython spawns the process, it reads the target file and records its content as the tag message. The application can then read the sensitive file content in-band:

from git import Repo
from git.refs.tag import TagReference
 
repo = Repo("/path/to/repo")
# Executes 'git tag -a -f -F /etc/passwd leak_tag'
tag_ref = TagReference.create(repo, "leak_tag", force=True, a=True, F="/etc/passwd")
leaked_data = tag_ref.tag.message
print(leaked_data)

Impact Assessment

The impact of these two primitives is high. The arbitrary file overwrite primitive enables attackers to compromise system integrity. If the application runs with root privileges or within a user directory, an attacker can overwrite critical files such as .bashrc, .ssh/authorized_keys, or configuration files, potentially escalating privileges or achieving remote code execution.

The arbitrary file read primitive directly breaks confidentiality. In automated environments, this allows attackers to leak configuration properties, local environment variables, system user information (such as /etc/passwd), or application source code. The data is returned directly to the calling context, which may output it to web interfaces or log collectors.

Because the underlying vulnerability pattern (opt-in security checks) relies on manual application on a per-wrapper basis, additional undocumented wrappers may still expose similar argument injection vectors. The CVSS score of 8.1 reflects high integrity and availability impact, though configuration-dependent confidentiality impacts are also severe.

Official Patches

gitpython-developersFix Commit
gitpython-developersPull Request

Fix Analysis (1)

Technical Appendix

CVSS Score
8.1/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

Affected Systems

GitPython

Affected Versions Detail

Product
Affected Versions
Fixed Version
gitpython
gitpython-developers
< 3.1.573.1.57
AttributeDetail
CWE IDCWE-88 (Argument Injection), CWE-20 (Improper Input Validation)
Attack VectorNetwork
CVSS Score8.1
ImpactHigh (Arbitrary File Overwrite / Arbitrary File Read)
Exploit StatusProof-of-Concept Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1202Indirect Command Execution
Execution
T1059Command and Scripting Interpreter
Execution
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

The application constructs an OS command using keyword arguments but does not neutralize or validate elements that can modify the command's actions, leading to argument injection.

Vulnerability Timeline

Security researchers identify 14 unguarded command-execution call sites on GitPython version 3.1.55.
2026-07-25
Core developers patch the vulnerability in commit 3af0c2516c5e18c829da30338614688f6b69b49c.
2026-07-26
Official security advisory GHSA-3f7w-8rr8-f37f is published alongside library version 3.1.57.
2026-08-03

References & Sources

  • [1]GitHub Security Advisory GHSA-3f7w-8rr8-f37f
  • [2]GitPython Pull Request 2193
  • [3]GitPython Fix Commit
  • [4]GitPython Source Repository
  • [5]GitPython Release 3.1.57

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•38 minutes ago•CVE-2026-126297
7.5

CVE-2026-126297: Algorithmic Complexity Denial of Service in NLTK ConllCorpusReader

CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).

Amit Schendel
Amit Schendel
1 views•12 min read
•about 2 hours ago•CVE-2026-126298
7.5

CVE-2026-126298: Quadratic Algorithmic Complexity Denial of Service in NLTK Tree.chomsky_normal_form

CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.

Alon Barad
Alon Barad
3 views•12 min read
•about 3 hours ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
4 views•10 min read
•about 4 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 5 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 6 hours ago•GHSA-GPWC-27CW-RH9R
5.3

CVE-2026-126301: Quadratic CPU Exhaustion in NLTK LegalitySyllableTokenizer

The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.

Amit Schendel
Amit Schendel
5 views•10 min read