CVE-2026-67325 in GitPython
Summary
by MITRE • 08/01/2026
GitPython before 3.1.51 contains an incomplete command injection blocklist that fails to account for git's long-option prefix abbreviation feature. Attackers can bypass the unsafe options guard by using abbreviated option names like upload_p instead of upload_pack, which git resolves to dangerous options and executes arbitrary commands.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 08/01/2026
GitPython versions prior to 3.1.51 contain a critical command injection vulnerability stemming from an incomplete blacklist implementation that fails to account for Git's long-option prefix abbreviation feature. This vulnerability arises when the library processes user-supplied input through its command execution mechanisms, where it attempts to sanitize potentially dangerous options by maintaining a blocklist of unsafe commands. However, this protection mechanism is fundamentally flawed because it does not consider that Git supports abbreviated long options, allowing attackers to bypass restrictions by using shorter variants of dangerous options.
The technical flaw specifically exploits the way Git handles option abbreviation where users can specify upload_pack as upload_p, and similar patterns for other dangerous options like receive_pack, upload_archive, and others. When Git processes these abbreviated options, it internally resolves them to their full long-form equivalents which are indeed dangerous and can execute arbitrary commands on the system. This abbreviation feature is documented in Git's manual where it explicitly states that long option names can be shortened as long as they remain unambiguous. The vulnerability exists because GitPython's sanitization logic only checks against the full option names, leaving abbreviated variants unfiltered.
This command injection vulnerability has severe operational implications for systems using vulnerable GitPython versions. Attackers can leverage this flaw to execute arbitrary commands on the target system with the privileges of the user running the GitPython application. The impact extends beyond simple code execution to include potential privilege escalation scenarios where attackers might gain access to sensitive data, modify repositories, or even establish persistent backdoors through compromised Git operations. This vulnerability particularly affects continuous integration systems, automated deployment pipelines, and any application that processes untrusted repository data or user input through GitPython.
The vulnerability maps directly to CWE-78 which describes improper neutralization of special elements used in OS commands, and aligns with ATT&CK technique T1059.006 for command and scripting interpreter. Organizations using vulnerable versions should immediately upgrade to GitPython 3.1.51 or later where the fix addresses this issue by implementing comprehensive option name checking that accounts for Git's abbreviation feature. Additional mitigations include restricting repository access permissions, implementing additional input validation layers, and monitoring for suspicious Git operations in system logs.
Security practitioners should also implement network-based detection measures to identify potential exploitation attempts, particularly looking for unusual patterns of git commands being executed with abbreviated options. The fix implemented in version 3.1.51 ensures that all possible abbreviations of dangerous Git options are properly blocked, thereby closing this injection vector entirely. This vulnerability demonstrates the importance of understanding underlying system behaviors when implementing security controls and highlights the need for comprehensive testing against edge cases in command execution contexts. Organizations should perform thorough penetration testing to verify that their GitPython implementations are not vulnerable to similar issues in other libraries or applications that process Git commands.