VDB
Sign up

PYSEC-2026-3786

Quick fix

PYSEC-2026-3786 — gitpython: upgrade to the fixed version with the command below.

pip install --upgrade 'gitpython>=3.1.59'

Details

GitPython before 3.1.59 fails to safely re-serialize multi-line git-config values during write operations, corrupting dormant quoted values into injected directives like core.hooksPath. Attackers can craft config files with embedded newlines that become live git directives after any unrelated GitPython config write, enabling arbitrary code execution via hook invocation.

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI/gitpython
Introduced in: 0Fixed in: 3.1.59
Fixpip install --upgrade 'gitpython>=3.1.59'

References