Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

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

0
Medium
Published: 08/03/2026 (08/03/2026, 20:23:17 UTC)
Source: GCVE Database
Product: GitPython

Description

GitPython versions up to 3.1.53 contain a vulnerability in the Commit.count() method where unguarded forwarding of options to git rev-list allows an attacker to specify an --output argument. This causes git rev-list to truncate an arbitrary file to zero bytes, resulting in file destruction. The vulnerability has medium severity with a CVSS score of 5.4. A patch is available that adds proper unsafe option checks to Commit.count().

CVSS v3.1

Score 5.4medium

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L

Affected software

PyPIghsa
GitPython
Affected versions
<3.1.56

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/03/2026, 21:23:59 UTC

Technical Analysis

The Commit.count() method in GitPython forwards keyword arguments directly to git rev-list without checking for unsafe options, unlike the sibling iter_items method which has such a guard. Specifically, passing an output parameter to count() results in git rev-list executing with --output=<path>, which truncates the specified file to zero bytes before processing revisions. This allows an attacker with the ability to influence the output argument to destroy or blank arbitrary files at the process privilege level. The vulnerability affects GitPython versions up to 3.1.53 and was confirmed by proof-of-concept truncation of files. The issue is distinct from previously fixed vulnerabilities in iter_commits and blame methods. The recommended fix is to add check_unsafe_options to Commit.count(), mirroring the protection in iter_items.

Potential Impact

An attacker able to control the output argument passed to Commit.count() can cause arbitrary files to be truncated to zero bytes, resulting in loss of file integrity and availability. The truncation occurs with the privileges of the running process. There is no content injection or confidentiality impact. The reachability is limited to contexts where the output argument can be influenced, and the impact is limited to file destruction (zero-byte truncation).

Mitigation Recommendations

A patch is available that adds unsafe option checks to Commit.count(), preventing injection of the --output argument. Users should upgrade to GitPython versions 3.1.56 or later where this fix is applied. Until patched, avoid passing untrusted input to Commit.count() keyword arguments, especially the output parameter.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-p538-c434-8v24
Osv Schema Version
1.4.0
Aliases
[]
Ecosystems
["PyPI"]
Database Specific Severity
MODERATE
Cvss Version
3.1

Threat ID: 6a710650bf32cb7a34392dd5

Added to database: 08/03/2026, 21:21:20 UTC

Last enriched: 08/03/2026, 21:23:59 UTC

Last updated: 08/04/2026, 01:04:01 UTC

Views: 3

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses