GitPython: Five Vulnerabilities Disclosed Together, Ranging From Command Injection to Env Var Leaks
Key findings • Five vulnerabilities in GitPython disclosed on August 2, 2026, impact versions prior to 3.1.50-3.1.52. • Multiple CVEs involve command injection via improper handling of Git op…

Key findings
- Five vulnerabilities in GitPython disclosed on August 2, 2026, impact versions prior to 3.1.50-3.1.52.
- Multiple CVEs involve command injection via improper handling of Git options and configuration.
- CVE-2026-67322 allows environment variable exfiltration through manipulated clone URLs.
- Patches are available in GitPython versions 3.1.50, 3.1.51, and 3.1.52.
- Users should update to the latest GitPython version to mitigate risks.
On August 2, 2026, a batch of five vulnerabilities was disclosed in GitPython, a popular Python library for interacting with Git repositories. These vulnerabilities, all disclosed on the same day, highlight several security weaknesses in how the library handles user-supplied input and Git configuration, potentially leading to command injection, arbitrary file writes, and environment variable exfiltration.
Several of the vulnerabilities stem from improper handling of Git configuration and options. CVE-2026-67326, affecting versions before 3.1.50, allows attackers to inject arbitrary section headers into the .git/config file by exploiting a failure to validate newline characters in the config_writer() function. This could enable the creation of a forged [core] section that points hooksPath to attacker-controlled directories, leading to remote code execution.
Command injection is a recurring theme, notably in CVE-2026-67323 (versions before 3.1.51) and CVE-2026-67325 (versions before 3.1.51). CVE-2026-67323 details how dangerous Git options, such as --exec or --upload-pack, passed as keyword arguments in Repo.archive() and git.ls_remote() can lead to arbitrary command execution. CVE-2026-67325 points to an incomplete blocklist that fails to account for Git's long-option prefix abbreviation feature, allowing attackers to bypass security guards by using abbreviated option names like upload_p instead of upload_pack.
Further issues arise from how GitPython processes command-line options. CVE-2026-67324 (affecting version 3.1.50) describes a failure to recognize joined short-option forms like -u<value> for --upload-pack=<value>. This bypasses the library's default unsafe-option gate when applications pass attacker-influenced clone options, potentially leading to unintended command execution.
Environment variable exfiltration is addressed in CVE-2026-67322 (versions before 3.1.52). In Repo.clone_from(), the remote URL is processed by os.path.expandvars() on non-Cygwin platforms before cloning. This allows an attacker controlling the clone URL to embed environment variable references like $NAME or ${NAME}, potentially leaking sensitive information.
The GitPython Project has addressed these issues in subsequent releases. Versions 3.1.50, 3.1.51, and 3.1.52 have been released to patch these vulnerabilities. Users are strongly advised to update to the latest available version of GitPython to mitigate these risks. The coordinated disclosure of these five CVEs underscores the importance of rigorous input validation and secure handling of external commands and configurations within software libraries. Patches are available for all affected versions.
This batch of vulnerabilities highlights critical areas for developers using GitPython: secure handling of Git configuration files, robust validation of command-line options passed to Git, and careful processing of URLs that might contain environment variables. Staying updated with the latest library releases is crucial for maintaining the security posture of applications relying on GitPython. The swift patching by the GitPython Project indicates a proactive approach to addressing these security concerns.