VAITP Dataset

← Back to the dataset

CVE-2026-78676

GitPython 3.1.58/59 unsafe re‑serialization injects config directives, leading to code exec.

  • CVSS 9.3
  • CWE-88
  • Input Validation and Sanitization
  • Local

GitPython before 3.1.59 fails to safely re-serialize multi-line git-config values during write operations, corrupting dormant quoted values into injected directives like core.hooksPath. Attackers can craft config files with embedded newlines that become live git directives after any unrelated GitPython config write, enabling arbitrary code execution via hook invocation.

CVSS base score
9.3
Published
2026-08-25
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Serialization Issues
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.59 or newer.

Vulnerable code sample

import git

def update_repo_config(repo_path, key, value):
    """
    Open the repository at `repo_path` and set a config entry.
    """
    repo = git.Repo(repo_path)
    # VULNERABLE: writes raw value, allowing embedded newlines to become directives
    repo.config_writer().set_value('core', key, value)
    repo.git.config('--unset', f'core.{key}', '--add')
    repo.config_writer().release()

Patched code sample

import git

def update_repo_config(repo_path, key, value):
    """
    Open the repository at `repo_path` and set a config entry.
    """
    repo = git.Repo(repo_path)
    # FIX: sanitize value to prevent newline injection
    safe_value = value.replace('\n', '\\n')
    repo.config_writer().set_value('core', key, safe_value)
    repo.git.config('--unset', f'core.{key}', '--add')
    repo.config_writer().release()

Cite this entry

@misc{vaitp:cve202678676,
  title        = {{GitPython 3.1.58/59 unsafe re‑serialization injects config directives, leading to code exec.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-78676},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-78676/}}
}

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.