Description
GitPython before 3.1.62 does not validate the `path` field read from an untrusted .gitmodules file when updating submodules. While a prior fix (GHSA-hmq2-w58f-27jc) added Submodule._validated_name() to constrain the `name` field, and GitPython's own containment guard Submodule._to_relative_path() is applied in add() and move(), Submodule.update() derives the absolute checkout location from the raw `path` value without that guard. A .gitmodules entry containing directory traversal components (e.g., path = ../../../tmp/escaped) can therefore cause directories to be created via os.makedirs() outside the repository working tree, populated from the submodule URL on the clone path, and removed via shutil.rmtree() when force_remove is used. Exploitation requires an application flow that updates submodules at a non-HEAD commit (such as a historical-commit API); the common clone-then-update flow re-derives the path from a canonical tree lookup and is not affected. The issue is fixed in GitPython 3.1.62.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| gitpython-developers | GitPython | < 3.1.62 | 3.1.62 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | python-git | 3.1.62-1 | — |
| Debian 13 | python-git | 3.1.44-1+deb13u1 | — |
| Debian 12 | python-git | 3.1.30-1+deb12u3 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | python-git | No fix yet | — |
Show 7 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 26.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 24.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 22.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 20.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 18.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 16.04 LTS | python-git | No fix yet | — |
| Ubuntu Pro 14.04 LTS | python-git | No fix yet | — |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | python-GitPython | 3.2.0-1.1 | openSUSE-SU-2026:11971-1 |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | gitpython | < 3.1.62 | 3.1.62 | GHSA-59cr-6r3x-644w |
Advisories 1
- openSUSE-SU-2026:11971-1 python313-GitPython-3.2.0-1.1 on GA media SUSE / openSUSE Security Updates · Oct 3, 2026
References
- GitHub Security Advisory (GHSA-59cr-6r3x-644w) vendor-advisory
- VulnCheck Advisory: GitPython before 3.1.62 Path Traversal via gitmodules path third-party-advisory