Skip to main content
Vulnerability Database/CVE-2026-100689

CVE-2026-100689: GitPython Path Traversal Vulnerability

CVE-2026-100689 is a path traversal vulnerability in GitPython allowing attackers to create directories outside repository boundaries through malicious .gitmodules files. This article covers technical details, exploitation scenarios, affected versions, and mitigation strategies.

Published:

CVE-2026-100689 Overview

CVE-2026-100689 is a path traversal vulnerability [CWE-22] in GitPython before version 3.1.62. The flaw exists in Submodule.update(), which derives the submodule checkout location from the raw path field of an untrusted .gitmodules file without applying the Submodule._to_relative_path() containment guard. An attacker who controls a repository's .gitmodules can supply directory traversal components in the path entry and cause file system operations outside the working tree. The issue is fixed in GitPython 3.1.62.

Critical Impact

Attackers can create, populate, and recursively delete arbitrary directories outside the repository working tree by submitting a crafted .gitmodules file processed by applications that update submodules at a non-HEAD commit.

Affected Products

  • GitPython versions prior to 3.1.62
  • Applications invoking Submodule.update() against attacker-controlled repositories at non-HEAD commits
  • Historical-commit APIs and services that process arbitrary repository history

Discovery Timeline

  • 2026-09-26 - CVE-2026-100689 published to the National Vulnerability Database (NVD)
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-100689

Vulnerability Analysis

The vulnerability stems from inconsistent validation of submodule path data within GitPython. A prior fix tracked as GHSA-hmq2-w58f-27jc introduced Submodule._validated_name() to constrain the name field read from .gitmodules. GitPython also implements Submodule._to_relative_path() as a containment guard that add() and move() apply before any file system operation. However, Submodule.update() does not apply that guard. Instead, it derives the absolute checkout destination directly from the raw path string parsed from .gitmodules.

This gap allows traversal sequences such as path = ../../../tmp/escaped to resolve outside the repository working tree. GitPython then calls os.makedirs() on the escaped location, clones submodule content from the configured URL into that directory, and later invokes shutil.rmtree() against the same path when callers pass force_remove=True.

Root Cause

The root cause is missing input validation on the path field read from an untrusted configuration file. The containment logic that already exists in GitPython was not applied uniformly across submodule operations, leaving update() to trust attacker-controlled file system paths.

Attack Vector

Exploitation requires an application flow that updates submodules at a non-HEAD commit, such as a historical-commit inspection API or any workflow that walks repository history. The standard clone-then-update flow re-derives the path from a canonical tree lookup and is not affected. A malicious repository publishes a .gitmodules entry whose path contains traversal components. When a vulnerable consumer processes a historical commit referencing that file, GitPython writes submodule content outside the intended working tree and may later delete the targeted directory recursively.

No verified public exploit code is available. See the GitHub Security Advisory GHSA-59cr-6r3x-644w and the VulnCheck Advisory for additional technical detail.

Detection Methods for CVE-2026-100689

Indicators of Compromise

  • Presence of .gitmodules entries where the path field contains .., absolute paths, or references to directories outside the repository root.
  • Unexpected directories created by Python processes outside configured repository working trees, especially under system temp or user home locations.
  • Recursive deletions originating from Python workers that handle Git submodule operations.

Detection Strategies

  • Inventory environments for GitPython installations below 3.1.62 using pip show GitPython or software bill of materials (SBOM) tooling.
  • Audit application code for callers of Submodule.update() operating on non-HEAD commits or against untrusted repositories.
  • Scan ingested repositories for .gitmodules files containing traversal sequences before invoking any submodule update logic.

Monitoring Recommendations

  • Log and alert on file system writes initiated by Git automation processes targeting paths outside sanctioned workspace directories.
  • Monitor shutil.rmtree() and os.makedirs() activity from repository processing services and compare target paths to the expected working tree root.
  • Capture process lineage for Git submodule operations to support investigation if traversal is observed.

How to Mitigate CVE-2026-100689

Immediate Actions Required

  • Upgrade GitPython to version 3.1.62 or later across all applications, build systems, and CI/CD runners.
  • Identify and temporarily disable application flows that call Submodule.update() at non-HEAD commits on untrusted repositories until the upgrade is deployed.
  • Review historical-commit APIs and sandboxing boundaries for services that process third-party repositories.

Patch Information

The vulnerability is fixed in GitPython 3.1.62. The fix applies the existing Submodule._to_relative_path() containment guard to the path value used by Submodule.update(), aligning its validation behavior with add() and move(). Full details are available in GitHub Security Advisory GHSA-59cr-6r3x-644w.

Workarounds

  • Restrict submodule updates to the standard clone-then-update flow, which re-derives the path from a canonical tree lookup and is not affected.
  • Validate the path field in .gitmodules against the repository working tree root before invoking any submodule operation, rejecting entries containing .. or absolute paths.
  • Execute untrusted repository processing in isolated containers or sandboxes with restricted file system access to limit the blast radius of traversal attempts.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.