CVE-2026-67326: GitPython newline injection in config_writer() section parameter

CVE-2026-67326 · Severity: high · CVSS 7 · Published 2026-08-01

GitPython is a widely-used Python library for interacting with Git repositories. A flaw in the config_writer() function fails to sanitize newline characters in the section parameter, allowing an attacker to inject arbitrary configuration headers into the .git/config file. By crafting a malicious section name, attackers can inject a fake [core] section pointing to attacker-controlled directories for Git hooks, leading to arbitrary code execution when users run standard Git operations like commits.

Technologies: Gitpython Project Gitpython, gitpython (PyPI). Vendors: Gitpython Project, PyPI.

Quick answers

Is CVE-2026-67326 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-67326 being exploited in the wild.
How severe is CVE-2026-67326?
High severity, with a CVSS score of 7, published 1 August 2026.
Which products and versions are affected?
gitpython (PyPI) ECOSYSTEM:introduced=0,fixed=3.1.50.
Is there a fix for CVE-2026-67326?
Yes. gitpython (PyPI): upgrade to 3.1.50 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-67326 attacked?
It is attacked with local access.
Am I affected by CVE-2026-67326?
Check whether you run Gitpython Project Gitpython or gitpython (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • gitpython (PyPI): upgrade to 3.1.50 or later
    pip install "gitpython>=3.1.50"

Technical details

The vulnerability is an improper input validation flaw (CWE-20) in GitPython's config_writer() method, which passes the section parameter directly to configparser without sanitizing newline characters. While a prior patch (CVE-2026-42215) validated the value parameter, the section and option parameters remain unvalidated. An attacker can inject "\n" sequences into the section argument to write multiple section headers into .git/config; for example, section="user]\n[core" results in both [user] and [core] headers being written. By injecting a malicious [core] section with hooksPath pointing to an attacker-controlled directory, code execution is achieved when any Git hook is triggered. The attack requires local filesystem access and user interaction (triggering a Git hook), but does not require elevated privileges. Patches are available in GitPython 3.1.50 and later.

Affected products

  • GitPython GitPython before 3.1.50

Identifiers

  • CVE-2026-67326
  • GHSA-mv93-w799-cj2w
  • PYSEC-2026-3980

Timeline

  • 2026-05-06: disclosed
  • 2026-05-06: patched: GitPython 3.1.50 and later
  • 2026-08-01: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.