Skip to content

← Actionable
Medium, CVSS 5.4

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

GHSA-p538-c434-8v24

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (gitpython 3.1.56), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

  • PyPI gitpython

    Affected
    <= 3.1.55
    Fixed in
    3.1.56

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS
5.4 · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
EPSS
No dated EPSS signal available.
Source description

As published by the source; long descriptions are shortened.

Summary Commit.count() forwards kwargs into revlist with no checkunsafeoptions guard (the guard exists only in the sibling iteritems, 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.revlist(self.hexsha, kwargs) with no checkunsafeoptions and no allowunsafeoptions parameter. The sibling iteritems (commit.py:341) is guarded; count is not. This is a distinct, uncovered sink — GHSA-956x-8gvw-wg5v fixed itercommits/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 Attack Chain 1. Entry: app forwards user options - commit.count(output='/victim'). Guard: none. Bypass proof: itercommits(output=) raises…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 1 · created ·

    Published from ghsa record GHSA-p538-c434-8v24

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: GHSA-p538-c434-8v24

Advisory: GitPython: Arbitrary file truncation via git rev-list --output argument injection in unguarded Commit.count
IDs: GHSA-p538-c434-8v24
Record: https://patchnext.com/advisories/ghsa-p538-c434-8v24 (revision 1, source checked 26 Oct 2026, 13:50 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Medium (CVSS 5.4)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: gitpython 3.1.56. A vendor fix does not mean a deployment is fixed.

## Affected components
- PyPI gitpython: affected <= 3.1.55; fixed in 3.1.56

## Suggested inspection (read-only)
- `python -m pip show gitpython`: prints the installed version. Run with the environment that serves production active.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on gitpython.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://github.com/advisories/GHSA-p538-c434-8v24 (GitHub-reviewed advisory GHSA-p538-c434-8v24 lists affected ranges: PyPI gitpython >=0 <=3.1.55)

Commands are suggestions: review each one before running it.

Loading voting…