PyPA Advisory Database
PYSEC-2026-3980
Details
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.
Affected packages
| Ecosystem | Package | Affected versions |
|---|---|---|
| PyPI | gitpython | All versions before 3.1.50 (fixed in 3.1.50) |