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·61 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

•about 2 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 3 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
5 views•9 min read
•about 4 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 5 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
7 views•9 min read
•about 6 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
6 views•11 min read
•about 7 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
5 views•10 min read