CVE-2026-100689 in GitPythoninfo

Summary

by MITRE • 09/26/2026

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.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 09/26/2026

GitPython versions prior to 3.1.62 contain a critical directory traversal vulnerability within the submodule update mechanism, specifically affecting how absolute checkout locations are derived from untrusted input. This flaw arises because the Submodule.update() method fails to validate or sanitize the path field extracted from an external .gitmodules file before using it to determine where files should be written on the local filesystem. While earlier security patches addressed related issues by introducing validation for the submodule name via Submodule._validated_name and applying containment guards like Submodule._to_relative_path during add and move operations, these safeguards were inadvertently omitted in the update workflow. Consequently, when an application processes a .gitmodules file containing maliciously crafted path entries with directory traversal sequences such as ../../../tmp/escaped, GitPython proceeds to create directories outside the intended repository working tree using os.makedirs(). This behavior allows attackers to write arbitrary files into sensitive system locations or other parts of the filesystem that are not protected by the repository's sandbox.

The operational impact of this vulnerability is severe, particularly in environments where applications automatically update submodules based on external configurations rather than internal canonical references. An attacker who can influence the content of a .gitmodules file associated with a target project can force GitPython to create directories and populate them with files fetched from arbitrary URLs specified in the submodule configuration. Furthermore, if the application utilizes the force_remove option during updates, the vulnerability extends beyond mere file creation to include potential data destruction or denial of service through shutil.rmtree() operations targeting unintended system paths. This capability effectively allows for remote code execution prerequisites by placing malicious scripts or binaries into executable directories, or it can be used to disrupt system integrity by overwriting critical configuration files located outside the project scope.

Exploitation of this flaw is contingent upon specific application workflows that trigger submodule updates at non-HEAD commits, such as those invoked through historical-commit APIs or explicit version pinning in deployment scripts. In contrast, standard clone-and-update flows are generally unaffected because they typically re-derive the path from a canonical tree lookup within the repository itself, which inherently restricts paths to valid locations relative to the working directory. However, any automated system that trusts external .gitmodules files and performs updates without verifying the resulting absolute paths against the repository root is vulnerable. This distinction highlights why the vulnerability persists in specific automation pipelines even though common usage patterns remain safe from this particular attack vector.

To mitigate this risk, organizations must immediately upgrade GitPython to version 3.1.62 or later, where the path validation logic has been corrected to ensure that all submodule paths are constrained within the repository working tree regardless of how they are sourced. For systems unable to update immediately, defensive coding practices should be implemented by manually validating any submodule paths against a whitelist of allowed directories before invoking GitPython functions. Additionally, applications should avoid trusting .gitmodules files from untrusted sources and instead rely on internal canonical references for path resolution whenever possible. This vulnerability is categorized under CWE-22: Improper Limitation of a Pathname to a Restricted Directory, which describes the failure to restrict pathname interpretation to a specific directory or file system location. In terms of offensive security frameworks, this flaw aligns with MITRE ATT&CK technique T1059 Command and Scripting Interpreter, as it enables an attacker to place files that can be executed by subsequent processes, thereby facilitating lateral movement or privilege escalation within the compromised environment.

Responsible

VulnCheck

Reservation

09/26/2026

Disclosure

09/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!