GHSA-hmq2-w58f-27jc: GitPython: Arbitrary Git Repository Creation Outside the Working Tree via Unvalidated .gitmodules Submodule Name in GitPython
(updated )
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
- github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3784.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-76222
- www.vulncheck.com/advisories/gitpython-before-path-traversal-via-gitmodules-submodule-name
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. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →