Executive brief
GitPython is a library used by developers to interact with Git repositories. A security flaw in the way it handles archive creation allows an attacker to read any file on the system that the application has access to. This could lead to the exposure of sensitive configuration files, credentials, or customer data if the application allows user-controlled input to reach the archive function.
Technical details
The `Repo.archive()` method in GitPython uses a denylist (`unsafe_git_archive_options`) to prevent the execution of dangerous Git flags. However, this list is incomplete and omits the `--add-file` and `--add-virtual-file` options. If an application passes user-supplied keyword arguments (kwargs) to `Repo.archive()`, an attacker can use these flags to include absolute file paths from the host filesystem into the generated archive. This results in an arbitrary file read vulnerability at the privilege level of the process. A related issue was also identified in `Repo.clone_from()` where the `--bundle-uri` option can bypass protocol checks to perform Server-Side Request Forgery (SSRF) or local file access. Users should update to version 3.1.57 or later.
Affected products
- gitpython-developers GitPython <= 3.1.56
Timeline
- 2026-07-25: disclosed: Vulnerability reported privately via GitHub PVR
- 2026-07-26: advisory: GitHub Advisory published
- 2026-08-03: patched: Fix released in version 3.1.57