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

CVE-2026-78679: GitPython Path Traversal Vulnerability

CVE-2026-78679 is a path traversal vulnerability in GitPython before version 3.1.59 affecting the TagReference.create() function. Attackers can exploit this flaw to read arbitrary files through crafted reference parameters. This article covers technical details, affected versions, security impact, and mitigation strategies.

Published:

CVE-2026-78679 Overview

CVE-2026-78679 is an arbitrary file read vulnerability in GitPython versions before 3.1.59. The flaw resides in the TagReference.create() method, where a positional reference parameter bypasses the library's unsafe option guard. Attackers with the ability to influence the reference argument can supply a value such as --file=<path>, causing the underlying git tag invocation to treat it as an option. The contents of the referenced file are then embedded in the annotated tag message and returned to the caller. The vulnerability is tracked under CWE-73: External Control of File Name or Path.

Critical Impact

Attackers who control the reference argument passed to TagReference.create() can read arbitrary files readable by the process, including source code, configuration files, and credentials.

Affected Products

  • GitPython versions prior to 3.1.59
  • Python applications that expose TagReference.create() with attacker-influenced reference values
  • CI/CD pipelines, Git automation tooling, and repository management services built on GitPython

Discovery Timeline

  • 2026-08-25 - CVE-2026-78679 published to NVD
  • 2026-08-27 - Last updated in NVD database

Technical Details for CVE-2026-78679

Vulnerability Analysis

GitPython wraps the git command-line executable and exposes Python bindings for repository operations. The TagReference.create() method constructs a git tag invocation using arguments derived from Python parameters. GitPython includes a guard that rejects option-like strings passed through certain unsafe parameters, but that guard is not applied to the positional reference argument.

When an attacker supplies a value formatted as a Git option, such as --file=/etc/passwd, the string is forwarded directly to git tag on the command line. Git interprets --file=<path> as an instruction to read the annotated tag message from that file. The file contents are stored as the tag's message and are subsequently returned through the object returned by TagReference.create(), exposing them to the caller.

Root Cause

The root cause is inconsistent input validation. GitPython enforces unsafe-option checks on parameters known to be user-controllable but omits the same check for the reference positional argument. Because the argument is concatenated into an argv array without a -- separator to terminate option parsing, Git treats attacker-supplied strings that begin with -- as flags rather than reference names.

Attack Vector

Exploitation requires an attacker to control, either directly or indirectly, the value passed as the reference parameter to TagReference.create(). This condition is common in web applications, Git-hosting platforms, CI/CD runners, and automation frameworks that accept user-supplied branch, tag, or commit identifiers. The attacker submits a crafted reference such as --file=/path/to/secret, and the target application returns the tag object whose message contains the file contents. The attack is network-reachable and requires only low privileges on the application, without user interaction. Refer to the GitHub Security Advisory GHSA-3wxw-xv34-2frg and the VulnCheck Advisory for GitPython for additional detail.

Detection Methods for CVE-2026-78679

Indicators of Compromise

  • Git tag objects whose annotated messages contain contents of host files such as /etc/passwd, .env, id_rsa, or application configuration.
  • Process execution telemetry showing git tag invocations with --file= arguments referencing paths outside the repository.
  • Application logs recording TagReference.create() calls where the reference parameter begins with --.

Detection Strategies

  • Inspect installed Python dependencies for GitPython<3.1.59 using pip list, SBOM data, or software composition analysis tooling.
  • Add runtime validation that rejects tag or reference names beginning with - before they reach GitPython APIs.
  • Audit application code for calls to TagReference.create() where the reference argument originates from HTTP parameters, webhooks, or job inputs.

Monitoring Recommendations

  • Alert on child git processes spawned by Python interpreters when command-line arguments include --file=, --upload-pack=, or similar option-injection patterns.
  • Monitor repositories for newly created annotated tags whose messages contain filesystem paths or credential material.
  • Correlate application access logs with tag-creation events to identify anomalous references containing option syntax.

How to Mitigate CVE-2026-78679

Immediate Actions Required

  • Upgrade GitPython to version 3.1.59 or later across all applications, containers, and CI/CD images.
  • Enumerate every code path that calls TagReference.create() and validate that the reference argument cannot start with -.
  • Rotate any secrets, tokens, or credentials that may have been readable by processes running vulnerable versions of GitPython.

Patch Information

GitPython 3.1.59 restores the unsafe-option guard on the reference argument of TagReference.create(). See the GitHub Security Advisory GHSA-3wxw-xv34-2frg for the fixed commit and release notes.

Workarounds

  • Sanitize inputs by rejecting any reference value that begins with - or contains = before invoking GitPython APIs.
  • Wrap TagReference.create() with a helper that prefixes references with refs/tags/ and validates against a strict allowlist pattern such as ^[A-Za-z0-9._/-]+$ with no leading -.
  • Run Git automation under a least-privileged service account whose filesystem view excludes secrets, configuration, and other sensitive artifacts.
bash
# Configuration example: upgrade GitPython and pin the fixed version
pip install --upgrade 'GitPython>=3.1.59'
pip show GitPython | grep -i version

# requirements.txt pin
# GitPython>=3.1.59

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

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.