GHSA-3wxw-xv34-2frg: Infoleak
Summary TagReference.create() forwards a caller-influenced positional reference value into git tag without it ever being inspected by the unsafe-option guard, allowing an arbitrary file read (the file's contents are returned in-band as the annotated tag message). This is an incomplete-fix bypass of commit 3af0c251 (the fix for GHSA-3f7w-8rr8-f37f's tag instance).
Root Cause The fix 3af0c251 added unsafegittagoptions = ["--file","-F"] and a guard call, but the guard is Git.checkunsafeoptions(options=Git.optioncandidates([], kwargs), unsafeoptions=...) at git/refs/tag.py:139 — it passes an EMPTY args list and inspects kwargs only. The dangerous values path and reference are POSITIONALS (args = (path, reference), tag.py:156), placed before any --. A user-influenced reference="--file=<path>" therefore reaches git tag as the exact --file option the fix intended to block, creating an annotated tag whose message is the file's contents.
Impact Arbitrary local file read at the privileges of the host process; contents returned in-band via tagref.tag.message. Requires the embedding application to forward a caller-influenced reference value into TagReference.create() (pure VALUE control — the CVE-2026-42215 threat model). Default allowunsafeoptions=False.
Proof of Concept python from git import TagReference t = TagReference.create(repo, "vpwn", reference="--file=/home/app/.ssh/idrsa") print(t.tag.message) # contents of the file
Attack Chain 1. Entry: app calls TagReference.create(repo, name, reference=<user>) with reference="--file=/home/app/.ssh/idrsa". 2. Check: Git.checkunsafeoptions(optioncandidates([], kwargs), ["--file","-F"]) @ tag.py:137-141. Guard: denylist includes --file/-F. Bypass proof: optioncandidates receives args=[] → the positional reference is never a candidate (the kwarg spelling file="…" IS blocked; only the positional escapes). 3. Sink: repo.git.tag(args, kwargs) @ tag.py:158 → no --. argv (observed): ['git','tag','-f','vpwn','--file=<secret>']. 4. Impact: annotated tag created; tagref.tag.message == file contents (arbitrary file read).
Bypass Evidence Independently reproduced (independent test harness, git 2.43.0, default allowunsafeoptions=False): TagReference.create(repo,'vp','--file=<secret>') → PASSED; tag.message == 'GATESECRETLINEA\nGATESECRETLINEB'. Control: TagReference.create(..., file='<secret>') → UnsafeOptionError: --file is not allowed. Fix-commit read: 3af0c251 adds optioncandidates([], kwargs) (empty args → positional never a candidate).
Affected Versions GitPython <= 3.1.58 (sink present verbatim on the latest release tag; git diff 3.1.57..HEAD touches only test files).
Suggested Fix Include the positional reference (and path) in the option-candidate list passed to checkunsafeoptions, or place a -- separator before the positional arguments in TagReference.create().
--- Reported by zx (Jace) — GitHub: @manus-use
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/GitPythonto a version that resolves this vulnerability.Fixed in 3.1.59 - Upgrade
Upgrade
GitPythonto a version that resolves this vulnerability.Fixed in 3.1.57Patch 3af0c251 - Configuration
Ensure TagReference.create uses the default allow_unsafe_options=False (i.e., do not override it to true) so unsafe options like --file/-F are denied.
GitPython TagReference.create / Git.check_unsafe_options allow_unsafe_options = false - Configuration
Apply the fix-commit behavior so the unsafe-option guard inspects positional arguments: include the positional reference (and path) in the option-candidate list passed to Git.check_unsafe_options (rather than calling it with an empty args list), or insert a `--` separator before positional arguments in TagReference.create().
GitPython tag.py (unsafe option guard) unsafe_git_tag_options = ["--file","-F"] - Compensating control
If you control the embedding application inputs, place a `--` separator before any positional arguments passed to TagReference.create()/repo.git.tag so that user-controlled values cannot be interpreted as `git tag` options (e.g., `-- <path> <reference>`).
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments are exposed when an embedding application passes a caller-influenced reference value to GitPython's TagReference.create(). The issue affects the positional reference argument rather than keyword options.
What does an attacker need to exploit this?
An attacker needs control over the reference value that the application forwards to TagReference.create(). Supplying a value such as --file=<path> causes it to be interpreted by git tag as a file option.
What can an attacker obtain?
The attacker can read arbitrary local files accessible to the host process running the application. The file contents are returned in-band through the annotated tag message, via tagref.tag.message.