<?xml version="1.0" encoding="UTF-8"?>
<cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1" xmlns:cvrf="http://www.icasi.org/CVRF/schema/cvrf/1.1">
	<DocumentTitle xml:lang="en">An update for python-GitPython is now available for openEuler-24.03-LTS</DocumentTitle>
	<DocumentType>Security Advisory</DocumentType>
	<DocumentPublisher Type="Vendor">
		<ContactDetails>openeuler-security@openeuler.org</ContactDetails>
		<IssuingAuthority>openEuler security committee</IssuingAuthority>
	</DocumentPublisher>
	<DocumentTracking>
		<Identification>
			<ID>openEuler-SA-2026-2306</ID>
		</Identification>
		<Status>Final</Status>
		<Version>1.0</Version>
		<RevisionHistory>
			<Revision>
				<Number>1.0</Number>
				<Date>2026-05-15</Date>
				<Description>Initial</Description>
			</Revision>
		</RevisionHistory>
		<InitialReleaseDate>2026-05-15</InitialReleaseDate>
		<CurrentReleaseDate>2026-05-15</CurrentReleaseDate>
		<Generator>
			<Engine>openEuler SA Tool V1.0</Engine>
			<Date>2026-05-15</Date>
		</Generator>
	</DocumentTracking>
	<DocumentNotes>
		<Note Title="Synopsis" Type="General" Ordinal="1" xml:lang="en">python-GitPython security update</Note>
		<Note Title="Summary" Type="General" Ordinal="2" xml:lang="en">An update for python-GitPython is now available for openEuler-24.03-LTS</Note>
		<Note Title="Description" Type="General" Ordinal="3" xml:lang="en">GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.

Security Fix(es):

### Summary
GitPython blocks dangerous Git options such as `--upload-pack` and `--receive-pack` by default, but the equivalent Python kwargs `upload_pack` and `receive_pack` bypass that check. If an application passes attacker-controlled kwargs into `Repo.clone_from()`, `Remote.fetch()`, `Remote.pull()`, or `Remote.push()`, this leads to arbitrary command execution even when `allow_unsafe_options` is left at its default value of `False`.

### Details
GitPython explicitly treats helper-command options as unsafe because they can be used to execute arbitrary commands:

- `git/repo/base.py:145-153` marks clone options such as `--upload-pack`, `-u`, `--config`, and `-c` as unsafe.
- `git/remote.py:535-548` marks fetch/pull/push options such as `--upload-pack`, `--receive-pack`, and `--exec` as unsafe.

The vulnerable API paths check the raw kwarg names before they&apos;re its normalized into command-line flags:

- `Repo.clone_from()` checks `list(kwargs.keys())` in `git/repo/base.py:1387-1390`
- `Remote.fetch()` checks `list(kwargs.keys())` in `git/remote.py:1070-1071`
- `Remote.pull()` checks `list(kwargs.keys())` in `git/remote.py:1124-1125`
- `Remote.push()` checks `list(kwargs.keys())` in `git/remote.py:1197-1198`

That validation is performed by `Git.check_unsafe_options()` in `git/cmd.py:948-961`. The validator correctly blocks option names such as `upload-pack`, `receive-pack`, and `exec`.

Later, GitPython converts Python kwargs into Git command-line flags in `Git.transform_kwarg()` at `git/cmd.py:1471-1484`. During that step, underscore-form kwargs are dashified:

- `upload_pack=...` becomes `--upload-pack=...`
- `receive_pack=...` becomes `--receive-pack=...`

Because the unsafe-option check runs before this normalization, underscore-form kwargs bypass the safety check even though they become the exact dangerous Git flags that the code is supposed to reject.

In practice:

- `remote.fetch(**{&quot;upload-pack&quot;: helper})` is blocked with `UnsafeOptionError`
- `remote.fetch(upload_pack=helper)` is allowed and reaches helper execution

The same bypass works for:

```python
Repo.clone_from(origin, out, upload_pack=helper)
repo.remote(&quot;origin&quot;).fetch(upload_pack=helper)
repo.remote(&quot;origin&quot;).pull(upload_pack=helper)
repo.remote(&quot;origin&quot;).push(receive_pack=helper)
```

This does not appear to affect every unsafe option. For example, `exec=` is already rejected because the raw kwarg name `exec` matches the blocked option name before normalization.

Existing tests cover the hyphenated form, not the vulnerable underscore form. For example:

- `test/test_clone.py:129-136` checks `{&quot;upload-pack&quot;: ...}`
- `test/test_remote.py:830-833` checks `{&quot;upload-pack&quot;: ...}`
- `test/test_remote.py:968-975` checks `{&quot;receive-pack&quot;: ...}`

Those tests correctly confirm the literal Git option names are blocked, but they do not exercise the normal Python kwarg spelling that bypasses the guard.

### PoC
1. Create and activate a virtual environment in the repository root:

```bash
python3 -m venv .venv-sec
.venv-sec/bin/pip install setuptools gitdb
source ./.venv-sec/bin/activate
```

2. make a new python file and put the following in there, then run it:

```python
import os
import stat
import subprocess
import tempfile

from git import Repo
from git.exc import UnsafeOptionError

# Setup: create isolated repositories so the PoC uses a normal fetch flow.
base = tempfile.mkdtemp(prefix=&quot;gp-poc-risk-&quot;)
origin = os.path.join(base, &quot;origin.git&quot;)
producer = os.path.join(base, &quot;producer&quot;)
victim = os.path.join(base, &quot;victim&quot;)
proof = os.path.join(base, &quot;proof.txt&quot;)
wrapper = os.path.join(base, &quot;wrapper.sh&quot;)

# Setup: this wrapper is just to demo things you can do, not required for the exploit to work
# you could also do something like an SSH reverse shell, really anything
with open(wrapper, &quot;w&quot;) as f:
    f.write(f&quot;&quot;&quot;#!/bin/sh
{{
  echo &quot;code_exec=1&quot;
  echo &quot;whoami=$(id)&quot;
  echo &quot;cwd=$(pwd)&quot;
  echo &quot;uname=$(uname -a)&quot;
  printf &apos;argv=&apos;; printf &apos;&lt;%s&gt;&apos; &quot;$@&quot;; echo
  env | grep -E &apos;^(HOME|USER|PATH|SSH_AUTH_SOCK|CI|GITHUB_TOKEN|AWS_|AZURE_|GOOGLE_)=&apos; | sed &apos;s/=.*$/=(CVE-2026-42215)

A vulnerability in GitPython allows attackers who can supply a crafted reference path to an application using GitPython to write, overwrite, move, or delete files outside the repository&apos;s .git directory via insufficient validation of reference paths in reference creation, rename, and delete operations.(CVE-2026-44243)

`GitConfigParser.set_value()` passes values to Python&apos;s `configparser` without validating for newlines. GitPython&apos;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&apos;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&apos;s `project.push()` method, which passes `author_name` and `author_email` directly to `config_writer().set_value()` with no sanitization. Both parameters cross a trust boundary — they are caller-supplied API inputs that end up in `.git/config`.

Impact: This is persistent repo config poisoning. Any user who can supply `author_name` or `author_email` to an application calling `config_writer().set_value()` 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.(CVE-2026-44244)</Note>
		<Note Title="Topic" Type="General" Ordinal="4" xml:lang="en">An update for python-GitPython is now available for master/openEuler-20.03-LTS-SP4/openEuler-22.03-LTS-SP4/openEuler-24.03-LTS/openEuler-24.03-LTS-Next/openEuler-24.03-LTS-SP1/openEuler-24.03-LTS-SP3/openEuler-24.03-LTS-SP4.

openEuler Security has rated this update as having a security impact of high. A Common Vunlnerability Scoring System(CVSS)base score,which gives a detailed severity rating, is available for each vulnerability from the CVElink(s) in the References section.</Note>
		<Note Title="Severity" Type="General" Ordinal="5" xml:lang="en">High</Note>
		<Note Title="Affected Component" Type="General" Ordinal="6" xml:lang="en">python-GitPython</Note>
	</DocumentNotes>
	<DocumentReferences>
		<Reference Type="Self">
			<URL>https://www.openeuler.org/zh/security/security-bulletins/detail/?id=openEuler-SA-2026-2306</URL>
		</Reference>
		<Reference Type="openEuler CVE">
			<URL>https://www.openeuler.org/en/security/cve/detail/?cveId=CVE-2026-42215</URL>
			<URL>https://www.openeuler.org/en/security/cve/detail/?cveId=CVE-2026-44243</URL>
			<URL>https://www.openeuler.org/en/security/cve/detail/?cveId=CVE-2026-44244</URL>
		</Reference>
		<Reference Type="Other">
			<URL>https://nvd.nist.gov/vuln/detail/CVE-2026-42215</URL>
			<URL>https://nvd.nist.gov/vuln/detail/CVE-2026-44243</URL>
			<URL>https://nvd.nist.gov/vuln/detail/CVE-2026-44244</URL>
		</Reference>
	</DocumentReferences>
	<ProductTree xmlns="http://www.icasi.org/CVRF/schema/prod/1.1">
		<Branch Type="Product Name" Name="openEuler">
			<FullProductName ProductID="openEuler-24.03-LTS" CPE="cpe:/a:openEuler:openEuler:24.03-LTS">openEuler-24.03-LTS</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="src">
			<FullProductName ProductID="python-GitPython-3.1.49-1" CPE="cpe:/a:openEuler:openEuler:24.03-LTS">python-GitPython-3.1.49-1.oe2403.src.rpm</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="noarch">
			<FullProductName ProductID="python-GitPython-help-3.1.49-1" CPE="cpe:/a:openEuler:openEuler:24.03-LTS">python-GitPython-help-3.1.49-1.oe2403.noarch.rpm</FullProductName>
			<FullProductName ProductID="python3-GitPython-3.1.49-1" CPE="cpe:/a:openEuler:openEuler:24.03-LTS">python3-GitPython-3.1.49-1.oe2403.noarch.rpm</FullProductName>
		</Branch>
	</ProductTree>
	<Vulnerability Ordinal="1" xmlns="http://www.icasi.org/CVRF/schema/vuln/1.1">
		<Notes>
			<Note Title="Vulnerability Description" Type="General" Ordinal="1" xml:lang="en">### Summary
GitPython blocks dangerous Git options such as `--upload-pack` and `--receive-pack` by default, but the equivalent Python kwargs `upload_pack` and `receive_pack` bypass that check. If an application passes attacker-controlled kwargs into `Repo.clone_from()`, `Remote.fetch()`, `Remote.pull()`, or `Remote.push()`, this leads to arbitrary command execution even when `allow_unsafe_options` is left at its default value of `False`.

### Details
GitPython explicitly treats helper-command options as unsafe because they can be used to execute arbitrary commands:

- `git/repo/base.py:145-153` marks clone options such as `--upload-pack`, `-u`, `--config`, and `-c` as unsafe.
- `git/remote.py:535-548` marks fetch/pull/push options such as `--upload-pack`, `--receive-pack`, and `--exec` as unsafe.

The vulnerable API paths check the raw kwarg names before they&apos;re its normalized into command-line flags:

- `Repo.clone_from()` checks `list(kwargs.keys())` in `git/repo/base.py:1387-1390`
- `Remote.fetch()` checks `list(kwargs.keys())` in `git/remote.py:1070-1071`
- `Remote.pull()` checks `list(kwargs.keys())` in `git/remote.py:1124-1125`
- `Remote.push()` checks `list(kwargs.keys())` in `git/remote.py:1197-1198`

That validation is performed by `Git.check_unsafe_options()` in `git/cmd.py:948-961`. The validator correctly blocks option names such as `upload-pack`, `receive-pack`, and `exec`.

Later, GitPython converts Python kwargs into Git command-line flags in `Git.transform_kwarg()` at `git/cmd.py:1471-1484`. During that step, underscore-form kwargs are dashified:

- `upload_pack=...` becomes `--upload-pack=...`
- `receive_pack=...` becomes `--receive-pack=...`

Because the unsafe-option check runs before this normalization, underscore-form kwargs bypass the safety check even though they become the exact dangerous Git flags that the code is supposed to reject.

In practice:

- `remote.fetch(**{&quot;upload-pack&quot;: helper})` is blocked with `UnsafeOptionError`
- `remote.fetch(upload_pack=helper)` is allowed and reaches helper execution

The same bypass works for:

```python
Repo.clone_from(origin, out, upload_pack=helper)
repo.remote(&quot;origin&quot;).fetch(upload_pack=helper)
repo.remote(&quot;origin&quot;).pull(upload_pack=helper)
repo.remote(&quot;origin&quot;).push(receive_pack=helper)
```

This does not appear to affect every unsafe option. For example, `exec=` is already rejected because the raw kwarg name `exec` matches the blocked option name before normalization.

Existing tests cover the hyphenated form, not the vulnerable underscore form. For example:

- `test/test_clone.py:129-136` checks `{&quot;upload-pack&quot;: ...}`
- `test/test_remote.py:830-833` checks `{&quot;upload-pack&quot;: ...}`
- `test/test_remote.py:968-975` checks `{&quot;receive-pack&quot;: ...}`

Those tests correctly confirm the literal Git option names are blocked, but they do not exercise the normal Python kwarg spelling that bypasses the guard.

### PoC
1. Create and activate a virtual environment in the repository root:

```bash
python3 -m venv .venv-sec
.venv-sec/bin/pip install setuptools gitdb
source ./.venv-sec/bin/activate
```

2. make a new python file and put the following in there, then run it:

```python
import os
import stat
import subprocess
import tempfile

from git import Repo
from git.exc import UnsafeOptionError

# Setup: create isolated repositories so the PoC uses a normal fetch flow.
base = tempfile.mkdtemp(prefix=&quot;gp-poc-risk-&quot;)
origin = os.path.join(base, &quot;origin.git&quot;)
producer = os.path.join(base, &quot;producer&quot;)
victim = os.path.join(base, &quot;victim&quot;)
proof = os.path.join(base, &quot;proof.txt&quot;)
wrapper = os.path.join(base, &quot;wrapper.sh&quot;)

# Setup: this wrapper is just to demo things you can do, not required for the exploit to work
# you could also do something like an SSH reverse shell, really anything
with open(wrapper, &quot;w&quot;) as f:
    f.write(f&quot;&quot;&quot;#!/bin/sh
{{
  echo &quot;code_exec=1&quot;
  echo &quot;whoami=$(id)&quot;
  echo &quot;cwd=$(pwd)&quot;
  echo &quot;uname=$(uname -a)&quot;
  printf &apos;argv=&apos;; printf &apos;&lt;%s&gt;&apos; &quot;$@&quot;; echo
  env | grep -E &apos;^(HOME|USER|PATH|SSH_AUTH_SOCK|CI|GITHUB_TOKEN|AWS_|AZURE_|GOOGLE_)=&apos; | sed &apos;s/=.*$/=</Note>
		</Notes>
		<ReleaseDate>2026-05-15</ReleaseDate>
		<CVE>CVE-2026-42215</CVE>
		<ProductStatuses>
			<Status Type="Fixed">
				<ProductID>openEuler-24.03-LTS</ProductID>
			</Status>
		</ProductStatuses>
		<Threats>
			<Threat Type="Impact">
				<Description>High</Description>
			</Threat>
		</Threats>
		<CVSSScoreSets>
			<ScoreSet>
				<BaseScore>8.8</BaseScore>
				<Vector>AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H</Vector>
			</ScoreSet>
		</CVSSScoreSets>
		<Remediations>
			<Remediation Type="Vendor Fix">
				<Description>python-GitPython security update</Description>
				<DATE>2026-05-15</DATE>
				<URL>https://www.openeuler.org/zh/security/security-bulletins/detail/?id=openEuler-SA-2026-2306</URL>
			</Remediation>
		</Remediations>
	</Vulnerability>
	<Vulnerability Ordinal="2" xmlns="http://www.icasi.org/CVRF/schema/vuln/1.1">
		<Notes>
			<Note Title="Vulnerability Description" Type="General" Ordinal="1" xml:lang="en">A vulnerability in GitPython allows attackers who can supply a crafted reference path to an application using GitPython to write, overwrite, move, or delete files outside the repository&apos;s .git directory via insufficient validation of reference paths in reference creation, rename, and delete operations.</Note>
		</Notes>
		<ReleaseDate>2026-05-15</ReleaseDate>
		<CVE>CVE-2026-44243</CVE>
		<ProductStatuses>
			<Status Type="Fixed">
				<ProductID>openEuler-24.03-LTS</ProductID>
			</Status>
		</ProductStatuses>
		<Threats>
			<Threat Type="Impact">
				<Description>High</Description>
			</Threat>
		</Threats>
		<CVSSScoreSets>
			<ScoreSet>
				<BaseScore>7.8</BaseScore>
				<Vector>AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X</Vector>
			</ScoreSet>
		</CVSSScoreSets>
		<Remediations>
			<Remediation Type="Vendor Fix">
				<Description>python-GitPython security update</Description>
				<DATE>2026-05-15</DATE>
				<URL>https://www.openeuler.org/zh/security/security-bulletins/detail/?id=openEuler-SA-2026-2306</URL>
			</Remediation>
		</Remediations>
	</Vulnerability>
	<Vulnerability Ordinal="3" xmlns="http://www.icasi.org/CVRF/schema/vuln/1.1">
		<Notes>
			<Note Title="Vulnerability Description" Type="General" Ordinal="1" xml:lang="en">`GitConfigParser.set_value()` passes values to Python&apos;s `configparser` without validating for newlines. GitPython&apos;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&apos;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&apos;s `project.push()` method, which passes `author_name` and `author_email` directly to `config_writer().set_value()` with no sanitization. Both parameters cross a trust boundary — they are caller-supplied API inputs that end up in `.git/config`.

Impact: This is persistent repo config poisoning. Any user who can supply `author_name` or `author_email` to an application calling `config_writer().set_value()` 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.</Note>
		</Notes>
		<ReleaseDate>2026-05-15</ReleaseDate>
		<CVE>CVE-2026-44244</CVE>
		<ProductStatuses>
			<Status Type="Fixed">
				<ProductID>openEuler-24.03-LTS</ProductID>
			</Status>
		</ProductStatuses>
		<Threats>
			<Threat Type="Impact">
				<Description>High</Description>
			</Threat>
		</Threats>
		<CVSSScoreSets>
			<ScoreSet>
				<BaseScore>7.8</BaseScore>
				<Vector>AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H</Vector>
			</ScoreSet>
		</CVSSScoreSets>
		<Remediations>
			<Remediation Type="Vendor Fix">
				<Description>python-GitPython security update</Description>
				<DATE>2026-05-15</DATE>
				<URL>https://www.openeuler.org/zh/security/security-bulletins/detail/?id=openEuler-SA-2026-2306</URL>
			</Remediation>
		</Remediations>
	</Vulnerability>
</cvrfdoc>