Skip to main content
VulnerabilityPublished Updated

GitPython: Unguarded git option forwarding

Affects GitPythonSource GCVE Database

0

CVSS 7.5 High : upgrade to 3.1.58 soon.

Data as of 26 Oct 2026, 16:15 UTC

CVSS 3.1 base score
7.5High
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 3.1.58
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

What to do

Upgrade GitPython to 3.1.58.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.58
Fixed in
  • 3.1.58

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A patch is available that adds a check_unsafe_options guard to Repo.init(), including a denylist of unsafe options such as --template and --separate-git-dir. Users should upgrade to GitPython version 3.1.58 or later where this fix is implemented. Until patched, avoid passing untrusted input to the template parameter in Repo.init() to prevent arbitrary code execution.

Description

GitPython versions up to 3.1.57 have a vulnerability in the Repo.init() method where unsafe git options are forwarded without validation. Specifically, the --template option can be exploited by an attacker to plant malicious git hooks that execute arbitrary code during subsequent git operations. This occurs because Repo.init() directly passes kwargs to git init without checking for unsafe options, unlike the clone path which has protections. Exploitation requires the attacker to control the template directory and stage executable hooks. A fix is available that adds unsafe option checks to Repo.init().

References

Community reviews

Loading reviews…