CVE-2026-87818: GitPython argument injection in diff API via --no-index

CVE-2026-87818 · Severity: medium · CVSS 6.5 · Published 2026-09-09

GitPython is a popular library that allows developers to interact with Git repositories programmatically. Version 3.1.59 fails to properly restrict dangerous command-line options in its diff API, allowing attackers to read arbitrary files from the system if an application exposes the diff results to user input. By repeatedly querying files with specific patterns, attackers can extract sensitive single-line secrets like passwords or tokens through careful observation of success or error responses.

Technologies: Gitpython Project Gitpython, gitpython (PyPI). Vendors: Gitpython Project, PyPI.

Quick answers

Is CVE-2026-87818 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-87818 being exploited in the wild.
How severe is CVE-2026-87818?
Medium severity, with a CVSS score of 6.5, published 9 September 2026.
Which products and versions are affected?
gitpython (PyPI) >= 3.1.59, < 3.1.60, ECOSYSTEM:introduced=3.1.59, ECOSYSTEM:introduced=3.1.59,fixed=3.1.60.
Is there a fix for CVE-2026-87818?
Yes. gitpython (PyPI): upgrade to 3.1.60 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-87818 attacked?
It is attacked over the network.
Am I affected by CVE-2026-87818?
Check whether you run Gitpython Project Gitpython or gitpython (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • gitpython (PyPI): upgrade to 3.1.60 or later
    pip install "gitpython>=3.1.60"

Technical details

The vulnerability is an argument injection flaw (CWE-88) in GitPython's high-level diff API. The library failed to classify the --no-index option as unsafe when allow_unsafe_options=False (the default). The --no-index flag changes Git's interpretation of path arguments from repository-relative pathspecs to arbitrary filesystem paths. When combined with the still-allowed -I/--ignore-matching-lines option, attackers can create a content-dependent Boolean oracle: matching patterns return success with an empty DiffIndex, while non-matching patterns raise GitCommandError with exit code 1. An embedding application that forwards user-influenced diff options and paths while exposing this success/error distinction can be repeatedly queried to recover single-line secrets. The attack requires the attacker to influence diff options, both path operands, and repeated requests, but no authentication or special privileges. A fix (version 3.1.60+) classifies --no-index as unsafe unless explicitly allowed.

Affected products

  • GitPython Developers GitPython 3.1.59

Identifiers

  • CVE-2026-87818
  • GHSA-rw58-wc66-99g4
  • GHSA-whh4-5q6c-9v3x
  • PYSEC-2026-3983

Timeline

  • 2026-08-26: disclosed: GitHub Security Advisory GHSA-whh4-5q6c-9v3x published
  • 2026-09-09: advisory: CVE-2026-87818 published on NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.