CVE-2026-87818: GitPython Local File Disclosure via --no-index Option

gitpython Updated 01 Oct 2026

Summary

30/09/2026
Yes i
Moderate
6.5

CVE-2026-87818: GitPython 3.1.59 blocks a previously available local-file read path through unsafe git diff options such as -O/--orderfile. Affects gitpython versions >= 3.1.59, < 3.1.60. Fixed in 3.1.60. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

GitPython is a Python library used for interacting with Git repositories. It provides a high-level interface for Git operations, allowing developers to automate tasks and manipulate Git repositories programmatically. The library is widely used in various applications that require version control functionalities. However, a vulnerability has been identified in version 3.1.59, which allows for potential local file disclosure through unsafe diff options.

Vulnerability Detail

The vulnerability arises from the use of the --no-index option in GitPython's diff API, which allows arbitrary filesystem paths instead of repository-relative pathspecs. When combined with the -I/--ignore-matching-lines option, it creates a content-dependent Boolean oracle that can be exploited to read local file contents. This issue was confirmed in GitPython version 3.1.59, where the original unsafe option path was blocked, but the alternate path remains accessible without enabling unsafe options. Attackers can exploit this vulnerability by influencing diff options and paths, leading to the potential disclosure of sensitive local files.

How To Fix

Latest published version: 3.2.1 as of 23 Oct 2026

pip install --upgrade "gitpython==3.2.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.1.60

This is the first release that contains the fix.

pip install --upgrade "gitpython==3.1.60"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid using the --no-index option in the diff API unless absolutely necessary. Additionally, ensure that the allow_unsafe_options parameter is set to False to prevent the use of unsafe options.

Conclusion

The vulnerability CVE-2026-87818 in GitPython poses a significant risk of local file disclosure through the misuse of the --no-index option in the diff API. It is crucial for users to update to the patched version 3.1.60 or later to safeguard against potential exploitation. Additionally, employing workarounds can help mitigate risks until an upgrade is feasible.

See every vulnerability recorded for gitpython →

Share this vulnerability

FAQ

CVE-2026-87818 is a vulnerability in GitPython that allows local file disclosure through the use of the --no-index option in the diff API.

GitPython version 3.1.59 is affected by this vulnerability. Version 3.1.60 and later contain the necessary fixes.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without requiring signup.

The potential impact includes unauthorized disclosure of local files that are readable by the process running GitPython, which could lead to exposure of sensitive information.

If immediate upgrade is not possible, avoid using the --no-index option and ensure that the allow_unsafe_options parameter is set to False to mitigate the risk.

Related vulnerabilities

Recent vulnerabilities recorded for gitpython.

How To Fix

Latest published version: 3.2.1 as of 23 Oct 2026

pip install --upgrade "gitpython==3.2.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.1.60

This is the first release that contains the fix.

pip install --upgrade "gitpython==3.1.60"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback