GitPython Flaws Let Attackers Bypass Option Checks and Execute Commands
Vulnerability Disclosure · 3 sources · Updated 4mo ago · First seen Apr 27, 2026

Two high-severity vulnerabilities in GitPython allowed attackers to bypass built-in safety checks and reach arbitrary command execution through Git operations. CVE-2026-42215 affects versions 3.1.30 through 3.1.46 and stems from GitPython validating blocked Git options before normalizing Python keyword arguments: values such as upload_pack could pass validation, then be converted into forbidden flags like --upload-pack when passed to Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push(). The flaw could let attacker-controlled input trigger command execution with the privileges of the Python process even when allow_unsafe_options=False.
A second flaw, CVE-2026-42284, affects GitPython before version 3.1.47 and involves unsafe handling of the multi_options parameter in _clone(). The library checked multi_options before later reprocessing it with shlex.split(" ".join(multi_options)), enabling crafted input to smuggle additional Git command-line arguments past validation. A string that appeared to be a valid branch selection could be split into separate options, including malicious configuration such as core.hooksPath, causing Git to execute attacker-controlled hooks during clone. Both issues were fixed in GitPython 3.1.47.


