← Blog · · df00tech

GitPython Config-Rewrite Bug Can Silently Turn Dormant Multi-Line Values Into Live core.hooksPath Injection (RCE)

breaking ghsa pip CVE-2026-78676

A newly published GitHub Security Advisory (GHSA-284h-m62q-gf8w, CVE-2026-78676, CVSS 9.8) reports a code execution flaw in GitPython, the widely used Python library for programmatically working with git repositories. Affected code is git/config.py in GitConfigParser, confirmed against GitPython at HEAD (commit 9729ed3b, version 3.1.58). A public proof-of-concept is included in the advisory.

What was reported

GitPython previously fixed several config-injection advisories by validating values passed as arguments to config setters like set_value() and add_value(), rejecting raw newlines or NUL bytes. This new report describes a different path: a git config file can legitimately contain a standard, spec-compliant multi-line quoted value that decodes in memory to a string containing an embedded newline. That value is inert as parsed. According to the advisory, when GitPython later rewrites the config file for any unrelated reason — e.g. a normal config_writer().set_value(...) call — its serialization logic (write_section()) emits that embedded newline as a bare, unquoted line break instead of re-quoting it. The second half of the value then becomes an independent new config line the next time the file is parsed. If that smuggled line is shaped like hooksPath = <attacker path>, it becomes a live core.hooksPath directive, which git honors on virtually every hook-triggering operation (commit, checkout, merge, push, rebase). The advisory states this reproduced end-to-end in testing.

Why it matters for defenders

This affects any application or automation that uses GitPython to open and write to repository config where the config content could be influenced by an untrusted source — for example a repository shipped with a pre-existing .git directory, a config that uses git's [include] mechanism pointing at a tracked file, or any other scenario where an attacker can seed a config file that a GitPython-based tool later touches. No unsafe argument needs to be passed by the calling application — an entirely ordinary, unrelated config write is enough to trigger the corruption, per the report. The outcome is arbitrary code execution the next time a hook-firing git command runs, which is a routine occurrence in CI pipelines, developer tooling, and any service that automates git operations on user- or third-party-supplied repositories.

What defenders should watch for or do now

  • Inventory services and CI/CD pipelines that use GitPython to open and write config on repositories whose .git directory or tracked files could originate from an untrusted source (vendored repos, cloned third-party projects, tarball/zip distributions that retain .git).
  • Watch for unexpected changes to core.hooksPath or newly appearing hook scripts in repositories processed by automation — file integrity monitoring on .git/config and .git/hooks (or wherever core.hooksPath points) is a reasonable hunting angle.
  • Review any workflow that clones or accepts external repositories and then performs a GitPython config write against them; treat that combination as a potential code-execution trust boundary until patched.
  • Track the upstream GHSA for a fixed GitPython release and plan to upgrade; in the interim, consider avoiding GitPython config writes on repositories from untrusted sources, or pre-validating/re-writing config files with a hardened path before use.

This is fresh, developing intelligence published today and has not yet been independently triaged against a shipped fix version — details, including the eventual patched release, may evolve. For full technical detail, the proof-of-concept, and updates, see the original advisory: GHSA-284h-m62q-gf8w.

Get new detections in your inbox

New ATT&CK coverage plus CISA KEV / CVE detection rules, roughly weekly. No spam, unsubscribe anytime.