Executive brief
GitPython is a Python library used to interact with Git repositories programmatically. A vulnerability in the TagReference.create() method allows attackers to read arbitrary files from the server by supplying a specially crafted reference parameter. An application using GitPython that forwards untrusted input to this method could expose sensitive files like SSH keys or configuration credentials.
Technical details
The vulnerability is an argument injection flaw (CWE-88, CWE-73) in GitPython's TagReference.create() method. A previous fix (commit 3af0c251) attempted to block unsafe git options like --file by inspecting only keyword arguments, but the method forwards caller-supplied positional arguments (path and reference) directly to the underlying git command without validation. An attacker can pass reference="--file=/path/to/file" which bypasses the guard and reaches git tag as a legitimate option, causing git to read the file and embed its contents in the annotated tag message. The vulnerability requires an embedding application to forward untrusted input into the reference parameter with allow_unsafe_options=False (the default). The fix in 3.1.59 includes positional arguments in the unsafe-options check or places a -- separator before positional arguments.
Affected products
- GitPython developers GitPython < 3.1.59
Timeline
- 2026-08-10: disclosed
- 2026-08-25: advisory
- 2026-08-25: patched: Fix released in version 3.1.59
- 2026-09-08: other: Duplicate advisory (GHSA-6rj2-96f5-chj9) withdrawn, canonical advisory is GHSA-3wxw-xv34-2frg