Description
GitPython before 3.1.50 fails to validate newline characters in the section parameter of config_writer(), allowing attackers to inject arbitrary section headers into .git/config. Attackers can inject newlines to create a forged [core] section with hooksPath pointing to attacker-controlled directories, achieving remote code execution when git hooks are triggered.
Published: 2026-08-01
Score: 7.3 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability is a newline injection in GitPython’s config_writer() function. The library does not sanitize the section parameter, allowing attackers to embed newline characters. By inserting newlines, a malicious user can forge a new section header in the repository’s .git/config file, such as a core section whose hooksPath points to an attacker‑controlled directory. When Git subsequently executes hooks from that directory, it runs attacker‑supplied scripts, giving remote code execution.

Affected Systems

All installations of GitPython version 3.1.49 and earlier. The affected product is the open‑source GitPython library maintained by the gitpython‑developers on the Python Package Index, commonly used in Python applications that interact with Git repositories.

Risk and Exploitability

The CVSS score of 7.3 indicates high severity and the lack of an EPSS score prevents a precise exploitation likelihood estimate. The vulnerability is not listed in CISA KEV, suggesting no confirmed widespread exploitation. Attackers must be able to invoke config_writer with a malicious section string, which generally requires code execution or supply of crafted data within a Python application. Once a forged hooksPath is in place, the risk escalates to full remote code execution whenever Git triggers hooks.

Generated by OpenCVE AI on August 2, 2026 at 02:58 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade GitPython to version 3.1.50 or later
  • If an upgrade is not immediately possible, validate or strip newline characters from any string passed to config_writer() before use
  • If the section value is constructed by a third‑party library, add input validation or escape the value to remove newlines
  • As a temporary mitigative measure, disable execution of Git hooks by setting core.hooksPath to a secure directory or removing the hooksPath entry from the repository’s configuration

Generated by OpenCVE AI on August 2, 2026 at 02:58 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sun, 02 Aug 2026 21:00:00 +0000

Type Values Removed Values Added
First Time appeared Gitpython-developers
Gitpython-developers gitpython
Vendors & Products Gitpython-developers
Gitpython-developers gitpython

Sat, 01 Aug 2026 12:45:00 +0000

Type Values Removed Values Added
Description GitPython before 3.1.50 fails to validate newline characters in the section parameter of config_writer(), allowing attackers to inject arbitrary section headers into .git/config. Attackers can inject newlines to create a forged [core] section with hooksPath pointing to attacker-controlled directories, achieving remote code execution when git hooks are triggered.
Title GitPython before 3.1.50 Newline Injection via config_writer section
Weaknesses CWE-20
References
Metrics cvssV3_1

{'score': 7, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 7.3, 'vector': 'CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

Gitpython-developers Gitpython
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-01T12:22:18.180Z

Reserved: 2026-07-29T13:07:21.184Z

Link: CVE-2026-67326

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-02T20:31:29Z

Weaknesses
  • CWE-20

    Improper Input Validation