CVE-2026-69097
GitPython 3.1.53 allows submodule name injection into .git/config, enabling RCE.
- CVSS 7.3
- CWE-74
- Input Validation and Sanitization
- Remote
GitPython before 3.1.53 fails to properly escape section names in git config files, allowing attackers to inject arbitrary configuration directives through malicious submodule names. Attackers can inject core.sshCommand or other dangerous config keys into the victim's .git/config via create_submodule or clone_from operations, achieving remote code execution when git performs ssh operations.
- CWE
- CWE-74
- CVSS base score
- 7.3
- Published
- 2026-08-03
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- GitPython
- Fixed by upgrading
- Yes
Solution
Upgrade GitPython to version 3.1.53 or newer.
Vulnerable code sample
import git
import os
def add_submodule(repo_path: str, submodule_url: str, submodule_name: str) -> None:
"""
Clone a repository and add a submodule with the given name.
"""
repo = git.Repo(repo_path)
# VULNERABLE: submodule_name is written directly into .git/config without escaping
repo.create_submodule(name=submodule_name,
path=os.path.join(repo_path, submodule_name),
url=submodule_url)Patched code sample
import git
import os
import re
def add_submodule(repo_path: str, submodule_url: str, submodule_name: str) -> None:
"""
Clone a repository and add a submodule with the given name.
"""
repo = git.Repo(repo_path)
# FIX: sanitize submodule_name to prevent config injection
safe_name = re.sub(r'[^A-Za-z0-9._-]', '_', submodule_name)
repo.create_submodule(name=safe_name,
path=os.path.join(repo_path, safe_name),
url=submodule_url)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- fix: validate config section delimiters (gitpython-developers/GitPython)
git/config.py · GitConfigParser._assure_config_name_safe
Cite this entry
@misc{vaitp:cve202669097,
title = {{GitPython 3.1.53 allows submodule name injection into .git/config, enabling RCE.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-69097},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-69097/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
