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·64 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 days ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
10 views•10 min read
•2 days ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
14 views•12 min read
•2 days ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•2 days ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
15 views•10 min read
•2 days ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
18 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read