DHI-2ywm-bcyy-ijaq-veve

Source
https://scout.docker.com/v/DHI-2ywm-bcyy-ijaq-veve
Import Source
https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json
JSON Data
https://api.osv.dev/v1/vulns/DHI-2ywm-bcyy-ijaq-veve
Upstream
Published
2026-11-13T20:19:18Z
Modified
2026-11-21T16:00:07Z
Severity
  • 6.1 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N CVSS Calculator
Summary
**Affected:** `GitPython` **3.1.61** (latest release) and `main` — `git/objects/submodule/base.py`. `git diff 3.1.61…
Details

Affected: GitPython 3.1.61 (latest release) and main — git/objects/submodule/base.py. git diff 3.1.61 origin/main -- git/objects/submodule/ is empty, so both are identical here.


The gap

The fix for GHSA-hmq2-w58f-27jc added Submodule._validated_name() and wired it into update() and five siblings, closing the .gitmodules name → .git/modules/<name> traversal. The other attacker-controlled .gitmodules field, path, is read raw:

# git/objects/submodule/base.py:172-177
def _set_cache_(self, attr):
    if attr in ("path", "_url", "_branch_path"):
        reader = self.config_reader()
        self.path = reader.get("path")          # raw .gitmodules value

and GitPython's own containment guard is applied in only two of the places that consume it:

400: def _to_relative_path(cls, parent_repo, path)      # the guard (abspath + commonpath containment)
542:     path = cls._to_relative_path(repo, path)        # add()   — guarded
1041:    module_checkout_path = self._to_relative_path(self.repo, module_path)   # move() — guarded

update() validates only the name and then uses the path-derived absolute location directly:

788:  self._validated_name(self.name)                    # NAME only
801:  checkout_module_abspath = self.abspath             # derived from self.path — unguarded
821:  os.makedirs(checkout_module_abspath, exist_ok=True)

So path = ../../../tmp/escaped in an attacker-authored .gitmodules selects the directory that gets created and, on the clone path, populated from the submodule URL. The same absolute location is what force_remove hands to shutil.rmtree.

The asymmetry is the argument: this is not a missing concept — the project wrote _to_relative_path() precisely for this, and add()/move() use it. update() does not.

Honest limits (please read before rating)

  • The most common flow is not affected. Repo.clone_from(...) → repo.submodules → sm.update(init=True) re-derives path from a canonical tree lookup, and real git refuses to check out a tree containing a .. component, so an evil .gitmodules never lands in the working tree in the first place. A reachable trigger therefore requires the victim's code to name a non-HEAD commit (a historical-commit API such as submodule_update(previous_commit=...)).
  • The researcher did not build that end-to-end trigger. The researcher only verified first-hand the code above: the guard's two call sites, the name-only validation in update(), and the unguarded abspath → os.makedirs() flow at 3.1.61 == main.

Suggested fix

Apply the guard the project already has, wherever the path is consumed:

# in update(), before deriving abspath (and in any other consumer of self.path):
checkout_rel = self._to_relative_path(self.repo, self.path)   # raises if it escapes the working tree

Better still, validate at the boundary: reject a .gitmodules entry whose path is absolute or contains a .. component when the section is first read in _set_cache_()/iter_items(), so no consumer can be added later without the check. A regression test with path = ../escaped alongside the existing name test would pin both fields.

Prior art checked

GHSA-hmq2-w58f-27jc (this is a residual of its fix, in the sibling field, not a re-report) plus the repository's 30 published advisories — none mentions the path field or _to_relative_path. Searched issues and PRs for _to_relative_path, gitmodules path and submodule traversal: no report of this.

Credit

kta1kri.


Appendix — EVIDENCE_gitpython_path_unguarded_20260901.txt (inlined; advisories accept no attachments)

=== EVIDENCE: GitPython — the .gitmodules 'path' field reaches os.makedirs()/clone unguarded ===
Mon Aug 31 18:45:22 UTC 2026

--- artifact: tag 3.1.61 (latest release); git diff 3.1.61 origin/main -- git/objects/submodule/ is empty ---

--- the containment guard GitPython owns, and its only two call sites ---
33:    _to_relative_path,
400:    def _to_relative_path(cls, parent_repo: "Repo", path: PathLike) -> PathLike:
407:            path = _to_relative_path(parent_repo.working_tree_dir, path)
542:        path = cls._to_relative_path(repo, path)
1041:        module_checkout_path = self._to_relative_path(self.repo, module_path)

--- the parent fix (_validated_name) call sites: it validates the NAME ---
309:    def _validated_name(cls, name: str) -> str:
321:        name = cls._validated_name(name)
541:        cls._validated_name(name)
788:            self._validated_name(self.name)
1040:        self._validated_name(self.name)
1181:        self._validated_name(self.name)
1439:        self._validated_name(self.name)
1440:        self._validated_name(new_name)
1489:        self._validated_name(self.name)

--- update(): name validated, path not; abspath -> os.makedirs ---

        try:
            self._validated_name(self.name)

            # ENSURE REPO IS PRESENT AND UP-TO-DATE
                # END early abort if init is not allowed

                checkout_module_abspath = self.abspath
                module_abspath = self._module_abspath(self.repo, self.path, self.name)

                # ``git submodule deinit`` leaves the repository in
                # ``.git/modules`` and empties the checkout. Reconnect that retained
                # repository instead of trying to clone over it.
                if not dry_run and osp.isdir(module_abspath):
                    try:
                        git.Repo(module_abspath)
                    except InvalidGitRepositoryError:
                        pass
                    else:
                        if osp.lexists(checkout_module_abspath) and (
                            osp.islink(checkout_module_abspath)
                            or not osp.isdir(checkout_module_abspath)
                            or os.listdir(checkout_module_abspath)
                        ):
                            raise OSError(
                                "Module directory at %r does already exist and is non-empty" % checkout_module_abspath
                            )
                        os.makedirs(checkout_module_abspath, exist_ok=True)
                        self._write_git_file_and_module_config(checkout_module_abspath, module_abspath)
                        mrepo = git.Repo(checkout_module_abspath)

--- where self.path comes from (raw .gitmodules value) ---
    def _set_cache_(self, attr: str) -> None:
        if attr in ("path", "_url", "_branch_path"):
            reader: SectionConstraint = self.config_reader()
            # Default submodule values.
            try:
                self.path = reader.get("path")
            except cp.NoSectionError as e:
References

Affected packages

Docker Hardened Images:Alpine:3.24
git-mcp

Package

Name
git-mcp
Purl
pkg:apk/dhi/git-mcp

Affected ranges

Affected versions

2026.*
2026.7.10-r0
2026.7.10-r2
2026.7.10-r3
2026.8.18-r0
2026.8.31-r0
2026.8.31-r1
2026.8.31-r2
2026.8.31-r3
2026.8.31-r4
2026.8.31-r5
2026.8.31-r6
2026.8.31-r7
2026.8.31-r8
2026.8.31-r9
2026.8.31-r10
2026.8.31-r11

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json"
Docker Hardened Images:Debian:13
datahub-ingestion

Package

Name
datahub-ingestion
Purl
pkg:deb/dhi/datahub-ingestion

Affected ranges

Affected versions

1.*
1.5.0.7-0
1.6.0.1-0
1.6.0.1-1
1.6.0.1-2
1.6.0.1-3
1.6.0.2-0
1.6.0.2-1
1.7.0.10-0
1.7.0.12-0
1.7.0.13-0
1.7.0.14-0
1.7.0.14-1
1.7.0.14-2
1.7.0.16-0
1.7.0.16-1
1.7.0.17-0
1.7.0.17-1
1.7.0.17-2
1.7.0.17-3
1.7.0.18-0
1.7.0.19-0
1.7.0.19-1
1.7.0.19-2
1.7.0.19-3
1.7.0.19-4
1.7.0.19-5
1.7.0.19-6
1.7.0.20-6
1.7.0.20-7
1.7.0.20-8

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json"
datascience-notebook

Package

Name
datascience-notebook
Purl
pkg:deb/dhi/datascience-notebook

Affected ranges

Affected versions

2026.*
2026.07.28-0
2026.07.28-1
2026.07.28-2
2026.07.28-3
2026.07.28-4
2026.07.28-5
2026.07.28-6
2026.07.28-7
2026.07.28-8
2026.07.28-9
2026.07.28-10
2026.07.28-11
2026.07.28-12
2026.07.28-13
2026.07.28-14
2026.07.28-15
2026.07.28-16
2026.07.28-17
2026.07.28-18
2026.07.28-19
2026.07.28-20
2026.07.28-21
2026.07.28-22

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json"
git-mcp

Package

Name
git-mcp
Purl
pkg:deb/dhi/git-mcp

Affected ranges

Affected versions

2026.*
2026.7.10-0
2026.7.10-1
2026.7.10-2
2026.7.10-3
2026.7.10-4
2026.7.10-5
2026.8.18-0
2026.8.18-1
2026.8.18-2
2026.8.31-0
2026.8.31-1
2026.8.31-2
2026.8.31-3
2026.8.31-4
2026.8.31-5
2026.8.31-6
2026.8.31-7
2026.8.31-8
2026.8.31-9
2026.8.31-10
2026.8.31-11
2026.8.31-12
2026.8.31-13
2026.8.31-14
2026.8.31-15
2026.8.31-16
2026.8.31-17
2026.8.31-18
2026.8.31-19
2026.8.31-20
2026.8.31-21
2026.8.31-22
2026.8.31-23
2026.8.31-24
2026.8.31-25
2026.8.31-26
2026.8.31-27

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json"
mlflow

Package

Name
mlflow
Purl
pkg:deb/dhi/mlflow

Affected ranges

Affected versions

3.*
3.15.1-0
3.15.2-0
3.15.2-1
3.15.2-2
3.16.0-0
3.16.1-0
3.16.1-1
3.16.1-2
3.16.1-3
3.16.1-4
3.16.1-5
3.16.1-6
3.17.0-0
3.17.0-1
3.17.1-0
3.17.2-0
3.17.2-1
3.17.2-2
3.17.2-3
3.17.2-4
3.17.2-5
3.17.2-6
3.18.0-0
3.18.0-1
3.18.0-2
3.18.0-3
3.18.0-4
3.18.0-5

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-2ywm-bcyy-ijaq-veve.json"