---
schema_version: '1.0'
id: security-20260804-5edd27
title: 'CVE-2026-73621: GitPython: Arbitrary file truncation via git rev-list --output
  argument injection in unguarded Commit.count'
url: https://osv.dev/vulnerability/GHSA-p538-c434-8v24
url_hash: 5edd27f7c0e4715f395a610f6dc5c7d87d1f73bebe694cbba1b3f401ce38081c
canonical_url: https://osv.dev/vulnerability/GHSA-p538-c434-8v24
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-73621
- GHSA-p538-c434-8v24
- severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
- gitpython
- PyPI
lang: en
published_at: '2026-08-03T20:23:17Z'
fetched_at: '2026-08-04T07:26:07.039373Z'
updated_at: '2026-08-22T14:29:49Z'
status: published
content_hash: 2cdd657dc37384eb9455fbbae49956b30219af25b9610ef19d2c1cf76770aaa1
content_changed_at: '2026-08-22T13:15:21.328163Z'
license_note: full
summary: 'GitPython: Arbitrary file truncation via git rev-list --output argument
  injection in unguarded Commit.count'
summary_source: rss
summary_en: 'GitPython: Arbitrary file truncation via git rev-list --output argument
  injection in unguarded Commit.count'
summary_omitted_reason: null
redistribution: true
keywords_en:
- Arbitrary
- argument
- Commit.count
- CVE
- CVE-2026-73621
- file
- GHSA-p538-c434-8v24
- git
- gitpython
- injection
- library vulnerability
- output
- PyPI
- rev-list
- severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
- software security
- truncation
- unguarded
- via
- Work Profile
entities_en:
- name: CVE
  type: data
- name: PyPI
  type: artifact
- name: Work Profile
  type: concept
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: PyPI
  type: artifact
- name: Work Profile
  type: concept
related_auto:
- name: Portal
  type: organization
  weight: 1.0
- name: Hugging Face
  type: organization
  weight: 1.0
computed_at: '2026-08-22T14:29:48Z'
---

# CVE-2026-73621: GitPython: Arbitrary file truncation via git rev-list --output argument injection in unguarded Commit.count

## TL;DR
GitPython: Arbitrary file truncation via git rev-list --output argument injection in unguarded Commit.count

## Key Points
- cve / CVE-2026-73621 / GHSA-p538-c434-8v24 / severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L / gitpython / PyPI

## Details
**Severity:** CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
**Advisory:** GHSA-p538-c434-8v24 (CVE-2026-73621)

**Details:**
## Summary
`Commit.count()` forwards `**kwargs` into `rev_list` with **no** `check_unsafe_options` guard (the guard exists only in the sibling `iter_items`, commit.py:341). `git rev-list --output=<path>` opens and truncates the target file to 0 bytes before revision parsing, so `count(output='/victim')` destroys/blanks an arbitrary file.

## Root Cause
`commit.py:290-291` calls `self.repo.git.rev_list(self.hexsha, **kwargs)` with no `check_unsafe_options` and no `allow_unsafe_options` parameter. The sibling `iter_items` (commit.py:341) is guarded; `count` is not. This is a distinct, uncovered sink — GHSA-956x-8gvw-wg5v fixed `iter_commits`/`blame`, not `count`.

## Impact
Destroy/blank an arbitrary file at process privilege (integrity/availability). Reachability is key-control only (`count` uses `self.hexsha`, not a user ref), and the write is a 0-byte truncation (no content control), so MEDIUM.

## Proof of Concept
```python
commit.count(output='/path/to/victim')   # victim truncated to 0 bytes (verified)
# control: commit.iter_commits(output=...) raises UnsafeOptionError
```

## Attack Chain
1. Entry: app forwards user options -> `commit.count(output='/victim')`. Guard: none. Bypass proof: `iter_commits(output=)` raises UnsafeOptionError; `count(output=)` does not — verified side-by-side.
2. Sink: `git rev-list <sha> --output=/victim` -> file truncated to 0 bytes. Impact: destroy/blank arbitrary file.

## Bypass Evidence
Live-verified on HEAD (tag 3.1.53): `count(output=<victim>)` truncated a pre-existing file to 0 bytes; guarded `iter_commits(output=)` raised UnsafeOptionError. Same CNA-accepted "app forwards user options dict" model as GHSA-956x-8gvw-wg5v's `archive(**kwargs)`. Uncovered sink, not a duplicate.

## Affected Versions
`<= 3.1.53`

## Suggested Fix
Add `check_unsafe_options` to `Commit.count` (mirroring `iter_items`).

---
Reported by **zx (Jace)** — GitHub: @manus-use

**References:**
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-p538-c434-8v24
- https://github.com/gitpython-developers/GitPython/pull/2184
- https://github.com/gitpython-developers/GitPython/commit/38553b6fddc7f6a667cdb45a6762343a08fc72b2
- https://github.com/gitpython-developers/GitPython
- https://github.com/gitpython-developers/GitPython/releases/tag/3.1.56

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-p538-c434-8v24_

## Source
元記事: [CVE-2026-73621: GitPython: Arbitrary file truncation via git rev-list --output argument injection in unguarded Commit.count](https://osv.dev/vulnerability/GHSA-p538-c434-8v24) — published 2026-08-03T20:23:17Z
