Skip to main content
VulnerabilityPublished

GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of

Affects GitPythonSource GCVE Database

0

Mentioned vulnerabilities

CVSS 7.1 High : upgrade to 3.2.0 soon.

Data as of 27 Oct 2026, 17:27 UTC

CVSS 4.0 base score
7.1High
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 3.2.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

What to do

Upgrade GitPython to 3.2.0.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.2.0
Fixed in
  • 3.2.0

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

AI-suggested

Upgrade GitPython to version 3.2.0 or later, where this vulnerability is fixed. The fix properly sanitizes the positional branch name argument in Head.checkout(). Until upgrading, avoid cloning and checking out untrusted repositories using vulnerable GitPython versions. No other mitigations are documented by the vendor.

Description

GitPython versions up to 3.1.62 contain a vulnerability in the Head.checkout() method that allows an attacker to cause an arbitrary file read via a specially crafted branch name. The flaw arises because the positional branch name argument is not properly sanitized and is passed directly to the git checkout command without a separator, enabling injection of options such as --pathspec-from-file to read files like /etc/passwd. This issue is an incomplete fix of previous advisories and affects all published releases up to 3.1.62. A fix is available in version 3.2.0.

References

Community reviews

Loading reviews…