GHSA-23mf-xhv8-69c2: GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679)
Head.checkout() guards its **kwargs against unsafe Git options but never inspects its own
positional argument — the branch name — which reaches the git checkout argv with no --
separator. A repository whose default branch is named --pathspec-from-file=/etc/passwd makes a
consumer that merely clones it and checks out the default branch return the entire contents of that
file to the caller.
This is the exact combination of two advisories the project already fixed:
- CVE-2026-76217 (
GHSA-hh9p-6wh2-4mfc) — “Arbitrary file read via--pathspec-from-fileinIndexFile.remove()andHead.checkout()”. Fixed in 3.1.58 by commitf2550b65, which added the guard to this exact method — but only for**kwargs. - CVE-2026-78679 (
GHSA-3wxw-xv34-2frg) — "TagReference.createpositional reference bypasses kwargs-only--fileguard, enabling arbitrary file read (incomplete fix of 3af0c251)". Fixed in 3.1.59 by commit1b0d2d9b, which applied the positional check togit/refs/tag.py,git/diff.py,git/index/base.pyandgit/repo/base.py— but not togit/refs/head.py:286.
f2550b65 states in its own commit message that the audit found the positional variant and applied
it to HEAD.reset — 185 lines above Head.checkout, in the same file, in the same commit:
“The audit also found that reset’s positional commit could carry the option before its argument separator. […] Check reset’s positional commit as well as keyword options”
HEAD.reset got the fix. Head.checkout did not, and 1b0d2d9b did not come back for it.
References
- github.com/advisories/GHSA-23mf-xhv8-69c2
- github.com/gitpython-developers/GitPython/commit/8da65080849a56a2fc9f3e7817bbf0524e8397d5
- github.com/gitpython-developers/GitPython/pull/2233
- github.com/gitpython-developers/GitPython/releases/tag/3.2.0
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-23mf-xhv8-69c2
Code Behaviors & Features
Detect and mitigate GHSA-23mf-xhv8-69c2 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →