GHSA-3rp5-jjmw-4wv2: GitPython: git-config section-name injection enables arbitrary config directives (core.sshCommand RCE)
(updated )
In GitPython <= 3.1.52, the config writer neutralizes only CR, LF, and NUL in configuration names, but writes section names into the [...] header with no other escaping. A section/subsection name that contains ] [ " closes the intended header and opens a second same-line section, injecting an arbitrary config directive — with no newline required. Because a submodule name is attacker-controlled data (it comes from a repository’s .gitmodules, or from an application that lets a user name a submodule) and is written verbatim into the parent repository’s trusted .git/config, an attacker can set core.sshCommand (or alias.*, core.pager, core.fsmonitor) and achieve remote code execution on the victim’s next git operation. Likely CWE-74 (Injection).
This is a distinct variant of the injection addressed by GHSA-mv93-w799-cj2w / GHSA-v87r-6q3f-2j67: those fixed newline injection into config values/names (patched in 3.1.50); the [r\n\x00] guard added for them does not stop a same-line section break inside a name.
References
- github.com/advisories/GHSA-3rp5-jjmw-4wv2
- github.com/gitpython-developers/GitPython/commit/1ed1b924f4e2d2ee7bab296df77b978af21853f1
- github.com/gitpython-developers/GitPython/pull/2176
- github.com/gitpython-developers/GitPython/releases/tag/3.1.53
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-3rp5-jjmw-4wv2
- github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3981.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-69097
- www.vulncheck.com/advisories/gitpython-before-config-injection-via-submodule-names
Code Behaviors & Features
Detect and mitigate GHSA-3rp5-jjmw-4wv2 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 →