VAITP Dataset

← Back to the dataset

CVE-2026-87818

GitPython diff –no-index misuse lets attackers read files and build a Boolean oracle.

  • CVSS 7.1
  • CWE-88
  • Information Leakage
  • Local

GitPython 3.1.59 fails to restrict the –no-index option in the high-level diff API, allowing attackers to read arbitrary filesystem paths as repository operands. Attackers can combine –no-index with -I/–ignore-matching-lines to create a content-dependent Boolean oracle, repeatedly querying local files to recover single-line secrets through distinguishable success or error responses.

CVSS base score
7.1
Published
2026-09-09
OWASP
A01 Broken Access Control
Orthogonal defect classification
Interface
Code defect classification
Incorrect Interface
Category
Information Leakage
Subcategory
Information Disclosure
Accessibility scope
Local
Impact
Information Disclosure
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.60 (or later) which patches the unsafe –no-index handling.

Vulnerable code sample

import git
import os

def generate_diff(repo_path: str, target_path: str):
    """
    Produce a diff between a repository and an arbitrary file using GitPython.
    """
    repo = git.Repo(repo_path)
    # VULNERABLE: allowing '--no-index' lets an attacker read any file
    diff = repo.git.diff('--no-index', repo_path, target_path, '--ignore-matching-lines=SECRET')
    return diff

Patched code sample

import git
import os

def generate_diff(repo_path: str, target_path: str):
    """
    Produce a diff between a repository and a file, disallowing '--no-index'.
    """
    repo = git.Repo(repo_path)
    # FIX: omit '--no-index' to prevent arbitrary filesystem reads
    diff = repo.git.diff(repo_path, target_path, '--ignore-matching-lines=SECRET')
    return diff

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve202687818,
  title        = {{GitPython diff --no-index misuse lets attackers read files and build a Boolean oracle.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-87818},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-87818/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.