Skip to main content
VulnerabilityPublished

GitPython: Incomplete unsafe_git_archive_options denylist omits --add-file / --add-virtual-file, enabling arbitrary file read via Repo.archive()

Affects GitPythonSource GCVE Database

0

CVSS 6.5 Medium : upgrade to 3.1.57 when convenient.

Data as of 3 Aug 2026, 21:24 UTC

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

What to do

Upgrade GitPython to 3.1.57.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.57
Fixed in
  • 3.1.57

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 for this vulnerability. The vendor or maintainers have extended the denylist to include --add-file and --add-virtual-file options or recommend implementing a strict allowlist of safe options for Repo.archive(). Users should upgrade GitPython to version 3.1.57 or later where this issue is fixed. If upgrading is not immediately possible, avoid passing user-controlled options to Repo.archive() or implement custom validation to block these unsafe options.

Description

GitPython's Repo.archive() method uses a denylist to block unsafe git archive options, but this denylist is incomplete. Specifically, the options --add-file and --add-virtual-file, which allow reading arbitrary files from the filesystem and injecting arbitrary content into archives, are not blocked. This enables an attacker who can control the options passed to Repo.archive() to read arbitrary files with the privileges of the running process. The vulnerability does not allow code execution but can lead to sensitive file disclosure. A patch is available that extends the denylist to cover these options or implements a safer allowlist approach.

References

Community reviews

Loading reviews…