Skip to main content
VulnerabilityPublished

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

Affects GitPythonSource GCVE Database

0

CVSS 5.4 Medium : upgrade to 3.1.56 when convenient.

Data as of 3 Aug 2026, 21:23 UTC

CVSS 3.1 base score
5.4Medium
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 3.1.56
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L

What to do

Upgrade GitPython to 3.1.56.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.56
Fixed in
  • 3.1.56

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

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.

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().

References

Community reviews

Loading reviews…