Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. GitPython
  4. ›
  5. GHSA-hmq2-w58f-27jc

GHSA-hmq2-w58f-27jc: GitPython: Arbitrary Git Repository Creation Outside the Working Tree via Unvalidated .gitmodules Submodule Name in GitPython

August 7, 2026

GitPython computes the on-disk location of a submodule’s separate Git directory (.git/modules/<name>) from the submodule’s .gitmodules section name with no validation. Because that name is fully attacker-controlled content of a cloned repository, a malicious repository can set a submodule name to a traversal string (e.g. ../../../../home/victim/.something) and cause GitPython to create and initialize a full Git repository at an attacker-chosen filesystem path outside the intended clone directory. The only precondition is that a victim clones the malicious repository with GitPython and runs submodule initialization (submodule_update(init=True) / sm.update(init=True)), a very common and often automatic step. Core Git itself already blocks this exact attack class (CVE-2018-11235), but GitPython’s independent reimplementation never adopted an equivalent check.

References

  • github.com/advisories/GHSA-hmq2-w58f-27jc
  • github.com/gitpython-developers/GitPython/commit/4299c990e1ca21896f9485277caf7bb0ae5b404c
  • github.com/gitpython-developers/GitPython/commit/e4b8e7d026ca6abb4cf604f8e77093432ce23c06
  • github.com/gitpython-developers/GitPython/pull/2202
  • github.com/gitpython-developers/GitPython/releases/tag/3.1.58
  • github.com/gitpython-developers/GitPython/security/advisories/GHSA-hmq2-w58f-27jc

Code Behaviors & Features

Detect and mitigate GHSA-hmq2-w58f-27jc with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 3.1.58

Fixed versions

  • 3.1.58

Solution

Upgrade to version 3.1.58 or above.

Impact 8.2 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:L

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  • CWE-73: External Control of File Name or Path

Source file

pypi/GitPython/GHSA-hmq2-w58f-27jc.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 12:16:13 +0000.