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-P538-C434-8V24

GHSA-P538-C434-8V24: Arbitrary File Truncation via Argument Injection in GitPython Commit.count

Amit Schendel
Amit Schendel
Senior Security Researcher

Aug 4, 2026·5 min read·0 visits

Executive Summary (TL;DR)

Unsafe forwarding of keyword arguments in GitPython's Commit.count method allows remote attackers to inject command-line flags like --output, causing arbitrary files on the local filesystem to be truncated to zero bytes.

GitPython prior to version 3.1.56 is vulnerable to argument injection in the Commit.count method. An attacker who controls keyword arguments passed to this method can inject arbitrary Git options, such as --output, leading to arbitrary file truncation on the host filesystem.

Vulnerability Overview

GitPython is an open-source Python library used to interact with Git repositories by programmatically wrapping the Git command-line binary. The library abstracts Git CLI commands into high-level Python objects, facilitating repository management, commit inspection, and history traversal.

Within this architecture, the Commit.count method is designed to count the number of commits reachable from a specific reference. To provide flexibility, the method dynamically forwards arbitrary keyword arguments to the underlying Git command execution layer.

This implementation exposes an argument injection attack surface. If an application forwards untrusted user input directly as keyword arguments into Commit.count, an attacker can inject arbitrary command-line parameters. Specifically, injecting the --output option instructs the Git binary to write command output to a specified target file, causing the system to truncate that file immediately.

Root Cause Analysis

The root cause of GHSA-P538-C434-8V24 is improper input validation (CWE-20) combined with argument injection (CWE-88) in git/objects/commit.py. The Commit.count method accepted raw keyword arguments (**kwargs) and forwarded them directly to the underlying execution process without validation.

When GitPython translates Python keyword arguments to Git CLI arguments, a key-value pair such as {"output": "/path/to/file"} is converted into --output=/path/to/file. While sibling APIs in GitPython implemented safety checks via Git.check_unsafe_options to filter out dangerous flags, the Commit.count method was left entirely unguarded.

When the underlying binary executes git rev-list --output=/path/to/file, the Git process immediately initiates a file write handle on the target path. As part of this standard file system operation, the target file is truncated to zero bytes before any commit logic is processed. This behavior is native to the Git binary and occurs regardless of the validity of the rest of the command execution.

Code Analysis

The vulnerability exists in the count method of the Commit class in git/objects/commit.py. Below is the vulnerable implementation where **kwargs are forwarded to the Git command execution without any filtering:

# Vulnerable implementation in git/objects/commit.py
def count(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs: Any) -> int:
    # Raw kwargs are directly forwarded without validation
    # ...

The security patch introduced in version 3.1.56 remediates this vulnerability by validating input options against a known blacklist of unsafe parameters. The following diff highlights the remediation steps implemented by the maintainers:

@@ -269,13 +269,21 @@ def summary(self) -> Union[str, bytes]:
         else:
             return self.message.split(b"\n", 1)[0]
 
-    def count(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs: Any) -> int:
+    def count(
+        self,
+        paths: Union[PathLike, Sequence[PathLike]] = "",
+        allow_unsafe_options: bool = False,
+        **kwargs: Any,
+    ) -> int:
         """Count the number of commits reachable from this commit.
 
         :param paths:
             An optional path or a list of paths restricting the return value to commits
             actually containing the paths.
 
+        :param allow_unsafe_options:
+            Allow unsafe options, like ``--output``.
+
         :param kwargs:
             Additional options to be passed to :manpage:`git-rev-list(1)`.
         """
+        if not allow_unsafe_options:
+            Git.check_unsafe_options(
+                options=Git._option_candidates([], kwargs), unsafe_options=self.unsafe_git_rev_options
+            )
+
         if paths:

This modification adds a default-false allow_unsafe_options parameter. When false, the method extracts command candidates and validates them against the self.unsafe_git_rev_options collection, effectively blocking dangerous options such as --output.

Exploitation Methodology

An attack requires that an application dynamically accepts user-controlled inputs and translates them into keyword arguments unpacked within the Commit.count method. The threat model typically involves an application exposing a web API that permits query parameter customization.

During exploitation, the attacker supplies a key-value pair where the key is set to output and the value is the path of a sensitive system or application file. The application unpacks these arguments directly into the method call.

Upon invocation, the library spawns the git rev-list command with the --output parameter. The operating system's file system handler, driven by the Git binary's initialization process, immediately empties the content of the target file to prepare it for writing. This sequence completes before any verification or commit counting occurs.

Impact Assessment

The security impact of GHSA-P538-C434-8V24 is high regarding integrity and availability, while maintaining low confidentiality impact. By exploiting this flaw, an unauthenticated attacker can disable services, corrupt configurations, or clear critical log archives on the hosting environment.

If the application process runs with elevated privileges, such as root or Administrator, the attacker can truncate system-critical files like /etc/hosts, systemd service files, or application binaries. This results in immediate denial of service or system instability.

In containerized environments or CI/CD pipelines, this vulnerability can be leveraged to corrupt build states or clear environment variables. Because GitPython is commonly integrated into automation frameworks, the potential radius of impact spans multiple connected systems.

Remediation and Bypasses

The definitive remediation is upgrading GitPython to version 3.1.56 or higher. This update enables the default option validation, raising an UnsafeOptionError if an unsafe parameter is supplied.

If immediate upgrade is not feasible, implement strict input sanitization on all dynamically generated keyword arguments before they are passed to GitPython. Applications must sanitize and filter input dictionaries to ensure no blacklisted keys, such as output, are allowed.

Additionally, developers must evaluate whether downstream parameters can bypass validation. For instance, passing malicious inputs through positional array parameters like paths could still result in option injection if the command builder fails to cleanly separate arguments using double dashes. Ensuring strict parameter isolation is vital for complete defense.

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10

Affected Systems

GitPython

Affected Versions Detail

Product
Affected Versions
Fixed Version
GitPython
gitpython-developers
< 3.1.563.1.56
AttributeDetail
CWE IDCWE-88 (Improper Control of Generation of Code / Argument Injection)
Attack VectorLocal/Remote parameter injection
CVSS Score7.5 (High)
EPSS ScoreN/A
ImpactArbitrary File Truncation
Exploit StatusPoC Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1211Exploitation for Defense Evasion
Defense Evasion
T1499Endpoint Denial of Service
Impact

Vulnerability Timeline

Security patch committed to GitPython main repository.
2026-07-25
GitPython version 3.1.56 tagged and released.
2026-07-25
GitHub Advisory GHSA-P538-C434-8V24 published.
2026-07-25

References & Sources

  • [1]Official GitHub Advisory
  • [2]Official GitPython Pull Request
  • [3]Official Patch Commit
  • [4]Official Release Notes

More Reports

•2 minutes ago•GHSA-3F7W-8RR8-F37F
8.1

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

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.

Alon Barad
Alon Barad
0 views•5 min read
•about 1 hour ago•GHSA-539M-9XH6-Q6RR
6.5

GHSA-539m-9xh6-q6rr: Arbitrary File Read and SSRF in GitPython via Missing Argument Denylist Sanitization

An argument injection vulnerability in GitPython allows remote or local attackers with control over repository archive configuration options to retrieve arbitrary local files via native git archive commands. During clone operations, a sibling missing validation vulnerability in the clone option engine allows attackers to perform Server-Side Request Forgery via the git clone bundle-uri mechanism.

Amit Schendel
Amit Schendel
0 views•6 min read
•about 3 hours ago•CVE-2026-69240
9.8

CVE-2026-69240: SQL Injection Vulnerability in Sequelize ORM Oracle Dialect

A critical SQL injection vulnerability was discovered in Sequelize when configured to use the Oracle database dialect. Due to a flawed optimization design in the SQL escaping subsystem (src/sql-string.js), strings that begin with native Oracle date functions bypass standard escaping. This allows unauthenticated remote attackers to execute arbitrary SQL commands on the target database.

Alon Barad
Alon Barad
5 views•6 min read
•about 4 hours ago•CVE-2026-59881
6.9

CVE-2026-59881: Unnegotiated WebSocket RSV1 Frame Handling in aiohttp

CVE-2026-59881 is a protocol compliance and input validation vulnerability in the client-side WebSocket implementation of the aiohttp asynchronous HTTP client/server framework for Python. Prior to version 3.14.2, the framework's parser unexpectedly accepts and attempts to decompress frames containing the RSV1 bit, even when the permessage-deflate extension has not been negotiated during the initial WebSocket handshake. This violation of RFC 6455 allows a malicious or compromised server to bypass client configuration, forcing decompression routines that can lead to high CPU and memory consumption, resulting in a denial-of-service condition.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 5 hours ago•CVE-2026-69243
6.3

CVE-2026-69243: HTTP Request Smuggling via WebSocket Upgrade State Desynchronization in aiohttp

An asynchronous HTTP client/server framework for asyncio and Python, aiohttp prior to version 3.14.2 is vulnerable to HTTP Request Smuggling. The server-side HTTP parser immediately transitions the protocol state to 'upgraded' upon receiving a WebSocket upgrade request before consuming the accompanying request body. If the backend handler rejects the upgrade request while keeping the TCP connection alive, the unconsumed request body remains in the socket buffer and is parsed as a subsequent pipelined HTTP request. This allows an attacker to smuggle requests, bypass frontend reverse proxy controls, and perform unauthorized actions.

Amit Schendel
Amit Schendel
4 views•8 min read
•about 6 hours ago•CVE-2026-69245
6.5

CVE-2026-69245: Noncanonical Cookie Domain Keeps Subdomain Scope in Guzzle

A vulnerability in the Guzzle HTTP client allows session identifiers, auth tokens, or cookies to be leaked to unauthorized hosts due to incorrect cookie domain validation of noncanonical IPv4 host formats. Guzzle failed to recognize octal, hexadecimal, and percent-encoded IP addresses as IP literals, treating them as standard domains and incorrectly extending their scope to subdomains.

Amit Schendel
Amit Schendel
3 views•7 min read