Junglewise Threat Intelligence

GitPython git-config section-name injection in submodule handling

Severity: high · CVSS 7 · Published 2026-07-24

Technologies: Gitpython-Developers Gitpython.

Executive brief

GitPython is a library used by developers to interact with Git repositories. A vulnerability in how it handles submodule names allows an attacker to inject malicious configuration settings into a user's local Git environment. If a user clones a malicious repository or an application uses untrusted input to create a submodule, the attacker can execute arbitrary code on the victim's machine during subsequent Git operations like fetching or pulling code.

Technical details

A configuration section-name injection vulnerability exists in GitPython's config writer. While the library neutralizes CR, LF, and NUL characters in configuration names, it fails to escape brackets (']', '[') or double quotes ('"'). An attacker can provide a submodule name containing these characters to close the intended '[submodule "..."]' header and open a new section on the same line, such as '[core]'. This allows the injection of dangerous Git directives like 'core.sshCommand', 'core.pager', or 'core.fsmonitor'. The vulnerability can be triggered when an application calls 'Repo.create_submodule' with untrusted input or when 'Repo.clone_from' is used on a malicious repository that contains a crafted '.gitmodules' file. This issue is patched in version 3.1.53.

Affected products

  • gitpython-developers GitPython <= 3.1.52

Timeline

  • 2026-07-20: advisory: Initial GitHub Advisory published
  • 2026-07-24: disclosed: Full advisory details published
  • 2026-07-24: patched: Fix released in version 3.1.53

References