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

CVE-2026-114145: GitPython RCE Vulnerability

CVE-2026-114145 is a remote code execution vulnerability in GitPython that allows attackers to execute malicious code through submodule path manipulation. This post explains its impact, affected versions, and mitigation steps.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-114145 Overview

GitPython is a Python library for interacting with Git repositories. Versions prior to 3.2.1 contain a flaw in create_submodule() within git/objects/submodule/base.py that accepts an attacker-influenced submodule path such as .git/hooks and invokes _clone_repo() before validating the destination. The weakness allows an attacker-controlled submodule to plant an executable post-checkout hook that a subsequent Git operation runs. The issue is fixed in version 3.2.1. The vulnerability is tracked as [CWE-696: Incorrect Behavior Order].

Critical Impact

Applications that accept untrusted submodule paths can be coerced into executing arbitrary code via planted Git hooks during routine repository operations.

Affected Products

  • GitPython versions 3.1.x (all affected revisions where _validate_repo_path() does not exist)
  • GitPython versions 3.2.0 through revisions prior to 3.2.1
  • Python applications that programmatically accept submodule paths from untrusted sources

Discovery Timeline

  • 2026-10-21 - CVE CVE-2026-114145 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-114145

Vulnerability Analysis

The flaw is a logic ordering defect in GitPython's submodule creation workflow. When create_submodule() is invoked, the library calls _clone_repo() and writes repository contents to the attacker-chosen destination before any path safety check runs. In 3.1.x releases, no validation routine exists at all, so the clone completes silently. In 3.2.0 and later affected revisions, _validate_repo_path() in git/index/base.py eventually raises ValueError, but only after disk mutation has already occurred, and the planted file is not removed.

The practical consequence is that an attacker can direct GitPython to clone into .git/hooks and leave an executable post-checkout hook behind. The next Git operation that triggers hook execution then runs the attacker's code in the context of the host process.

Root Cause

The root cause is incorrect sequencing of validation and side-effecting operations. Destination validation is performed after the clone writes data, violating the principle of validating inputs before mutating state. The fix in version 3.2.1, titled fix(submodule): validate destinations before mutation, reorders the logic so untrusted paths are rejected before _clone_repo() runs.

Attack Vector

Exploitation requires an application that accepts an untrusted submodule path and a clone destination such as .git/hooks that is empty enough for Git to clone into it. In practice this means the default sample hooks must be absent. User interaction is required because the planted hook executes only when a subsequent Git operation triggers the post-checkout lifecycle event.

text
 Changelog
 =========
 
+3.2.1
+=====
+
+Security fixes for
+
+* https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-83vg-56qc-22m7
+
+If you can, also try and provide feedback on the upcoming v4 branch
+https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome.
+
+See the following for all changes.
+https://github.com/gitpython-developers/GitPython/releases/tag/3.2.1
+
 3.2.0
 =====

Source: GitHub Commit 97eadb8 — this patch note documents the fix(submodule): validate destinations before mutation change that reorders validation ahead of the clone call.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-114145

Indicators of Compromise

  • Unexpected executable files inside .git/hooks/ directories, particularly post-checkout, post-merge, or post-update with recent modification times.
  • GitPython process spawning shell interpreters or unexpected child processes shortly after submodule operations.
  • Submodule configuration entries whose path values reference .git/hooks or other repository-internal paths.

Detection Strategies

  • Inventory Python environments for installed GitPython versions below 3.2.1 using pip list or SBOM data.
  • Audit application code that calls create_submodule() or Submodule.add() for sources of the path argument and reject externally supplied values.
  • Monitor filesystem activity on repository .git/hooks/ directories for writes originating from Python interpreters.

Monitoring Recommendations

  • Enable process-lineage telemetry on build servers and CI runners that invoke GitPython to flag hook executions following clone or submodule actions.
  • Alert on creation of files named post-checkout, pre-commit, or post-merge outside normal repository initialization workflows.

How to Mitigate CVE-2026-114145

Immediate Actions Required

  • Upgrade GitPython to version 3.2.1 or later across all development, CI, and production environments.
  • Audit applications that expose submodule paths to users and reject any input containing .git path segments.
  • Inspect existing repositories managed by GitPython for anomalous files inside .git/hooks/.

Patch Information

The fix is available in GitPython 3.2.1. See the GitHub Release Notes for 3.2.1, the GitHub Security Advisory GHSA-83vg-56qc-22m7, and the upstream pull request discussion for additional context. The commit 97eadb8 reorders validation to run before _clone_repo().

Workarounds

  • Validate and canonicalize submodule paths in application code before passing them to GitPython, rejecting any path that resolves inside the .git directory.
  • Ensure default Git sample hooks are present in repositories so that attacker-controlled clones into .git/hooks fail due to a non-empty destination.
  • Run GitPython-dependent workloads under least-privilege service accounts to limit the impact of hook execution.
bash
# Upgrade GitPython to the patched release
pip install --upgrade "GitPython>=3.2.1"

# Verify installed version
python -c "import git; print(git.__version__)"

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.