CVE-2026-44244: GitPython: Newline injection in config_writer().set_value() enables RCE via core.hooksPath

Published May 6, 2026
·
Updated

GitConfigParser.setvalue() passes values to Python's configparser without validating for newlines. GitPython's own write() converts embedded newlines into indented continuation lines (e.g. \n becomes \n\t), but Git still accepts an indented [core] stanza as a section header — so the injected core.hooksPath becomes effective configuration. Any Git operation that invokes hooks (commit, merge, checkout) will then execute scripts from the attacker-controlled path.

The vulnerability is not merely malformed config output: GitPython's own writer converts embedded newlines into indented continuation lines, but Git still accepts an indented [core] stanza as a section header, so the injected core.hooksPath becomes effective configuration.

This was found while auditing MLRun's project.push() method, which passes authorname and authoremail directly to configwriter().setvalue() with no sanitization. Both parameters cross a trust boundary — they are caller-supplied API inputs that end up in .git/config.

PoC (standalone, no MLRun required):

python import git, subprocess, os

repo = git.Repo("/tmp/testrepo")

with repo.configwriter() as cw: cw.setvalue("user", "name", "foo\n[core]\nhooksPath=/tmp/hooks")

r = subprocess.run(["git", "config", "core.hooksPath"], cwd="/tmp/testrepo", captureoutput=True, text=True) assert r.returncode == 0 print(r.stdout.strip()) # /tmp/hooks

os.makedirs("/tmp/hooks", existok=True) open("/tmp/hooks/pre-commit", "w").write("#!/bin/sh\nid > /tmp/pwned\n") os.chmod("/tmp/hooks/pre-commit", 0o755)

repo.index.add(["README"]) repo.git.commit(m="test") print(open("/tmp/pwned").read()) # uid=...

Tested on GitPython 3.1.46, git 2.39+.

Impact: This is persistent repo config poisoning. Any user who can supply authorname or authoremail to an application calling configwriter().setvalue() can redirect Git hook execution to an arbitrary path. In a multi-user or hosted environment (e.g. a shared MLRun server where multiple users push to the same repositories), one user can poison the .git/config of a shared repo and have their hooks run in the context of every subsequent Git operation by any user. On single-user deployments, the impact depends on whether the application later invokes Git hooks automatically.

Remediation: setvalue() should raise on CR, LF, or NUL in values rather than silently pass them through:

python import re

if isinstance(value, (str, bytes)) and re.search(r"[\r\n\x00]", str(value)): raise ValueError("Git config values must not contain CR, LF, or NUL")

Rejecting is safer than stripping — a stripped newline might indicate the caller is passing unsanitized input at a higher level, and silent normalization masks that.

Affected wherever configwriter().setvalue(section, key, userinput) is called with external input. GitPython is a dependency of DVC, MLflow, Kedro, and others — worth auditing their setvalue() call sites for externally influenced inputs.

Other sources

GitPython is a python library used to interact with Git repositories. Prior to version 3.1.49, GitConfigParser.setvalue() passes values to Python's configparser without validating for newlines. GitPython's own write() converts embedded newlines into indented continuation lines (e.g. \n becomes \n\t), but Git still accepts an indented [core] stanza as a section header — so the injected core.hooksPath becomes effective configuration. Any Git operation that invokes hooks (commit, merge, checkout) will then execute scripts from the attacker-controlled path. This issue has been patched in version 3.1.49.

MITRE

Affected Software

4 affected componentsFixes available
pip/GitPython<=3.1.48
3.1.49
Gitpython Project Gitpython Python<3.1.49
debian/python-git<=3.1.14-1, <=3.1.14-1+deb11u1, <=3.1.30-1+deb12u2, <=3.1.44-1
3.1.50-1
IBM API Connect V12 OnPrem<=All

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/GitPython to a version that resolves this vulnerability.

    Fixed in 3.1.49
  2. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.50-1
  3. Upgrade

    Upgrade GitPython to a version that resolves this vulnerability.

    Fixed in 3.1.49
  4. Configuration

    Modify/override GitPython usage so that calls to config_writer().set_value(section, key, user_input) (and underlying GitConfigParser.set_value) raise an error when the value contains CR (\r), LF (\n), or NUL (\x00), instead of silently accepting/normalizing them (rejecting is safer than stripping).

    GitPython config_writer().set_value() / GitConfigParser.set_value() value validation for CR, LF, NUL = reject if value contains any of [\r\n\x00]
  5. Compensating control

    Audit application call sites that pass external input into GitPython config_writer().set_value(section, key, user_input) (e.g., any user-supplied author_name/author_email that later reaches .git/config) and ensure untrusted callers cannot influence these fields for shared repositories where later Git operations (commit/merge/checkout) may execute hooks.

Event History

May 6, 2026
Advisory Published
via GitHub·09:58 PM
Data Sourced
via GitHub·09:58 PM
DescriptionSeverityWeaknessAffected Software
May 7, 2026
CVE Published
via MITRE·06:22 PM
Data Sourced
via MITRE·06:22 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
May 28, 2026
Data Sourced
via Ubuntu·02:11 AM
RemedyDescriptionSeverityAffected Software
Data Sourced
via Debian·02:12 AM
DescriptionAffected Software
Data Sourced
via Launchpad·02:12 AM
Description
Jul 7, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-44244?

CVE-2026-44244 has been classified as a moderate severity vulnerability.

2

How do I fix CVE-2026-44244?

To fix CVE-2026-44244, upgrade GitPython to version 3.1.49 or later.

3

What software is affected by CVE-2026-44244?

CVE-2026-44244 affects GitPython versions up to and including 3.1.48.

4

What type of vulnerability is CVE-2026-44244?

CVE-2026-44244 is related to improper input validation in the GitConfigParser component.

5

What are the consequences of CVE-2026-44244?

CVE-2026-44244 could allow attackers to manipulate configuration files by exploiting the newline handling.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203