{"id":2728,"cve":"CVE-2026-110859","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-110859\/","cwe":"CWE-88","cwe_number":88,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/88","cvss_score":8.7,"published":"2026-10-14","owasp":"A03 Injection","odc":"Interface","cdc":"Incorrect Interface","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Remote","impact":"Information Disclosure","summary":"Argument injection in GitPython\u00a0Head.checkout() enables file read via crafted branch name.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-110859\/","description":"GitPython before 3.2.0 contains an argument injection vulnerability in Head.checkout() that allows remote attackers to read arbitrary files by supplying a branch name parsed as a git option. Attackers can host a repository whose default branch is named --pathspec-from-file=, causing cloning applications that check out the active branch to leak file contents through GitCommandError messages.","solution":"Upgrade GitPython to version\u202f3.2.0\u202for later.","affected_component":"GitPython","fixed_by_upgrading":true,"vulnerable_code":"import os\nfrom git import Repo, GitCommandError\n\ndef checkout_branch(repo_path: str, branch_name: str) -> None:\n    \"\"\"\n    Clone a repository (if needed) and check out the given branch.\n    \"\"\"\n    if not os.path.isdir(repo_path):\n        Repo.clone_from(\"https:\/\/example.com\/repo.git\", repo_path)\n    repo = Repo(repo_path)\n\n    # VULNERABLE: branch name is passed directly to git checkout, allowing option injection\n    try:\n        repo.head.reference = repo.refs[branch_name]\n        repo.head.checkout()\n    except GitCommandError as e:\n        # Propagate the error (may contain leaked file contents)\n        raise e\n","patched_code":"import os\nfrom git import Repo, GitCommandError\n\ndef checkout_branch(repo_path: str, branch_name: str) -> None:\n    \"\"\"\n    Clone a repository (if needed) and safely check out the given branch.\n    \"\"\"\n    if not os.path.isdir(repo_path):\n        Repo.clone_from(\"https:\/\/example.com\/repo.git\", repo_path)\n    repo = Repo(repo_path)\n\n    # FIX: validate branch name and use '--' separator to prevent option injection\n    if branch_name.startswith('-') or ' ' in branch_name:\n        raise ValueError(\"Invalid branch name\")\n    try:\n        repo.head.reference = repo.refs[branch_name]\n        repo.git.checkout('--', branch_name)\n    except GitCommandError as e:\n        raise e\n","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[{"repository":"gitpython-developers\/GitPython","commit_url":"https:\/\/github.com\/gitpython-developers\/GitPython\/commit\/8da65080849a56a2fc9f3e7817bbf0524e8397d5","commit_subject":"fix: validate checkout positional reference options","units":[{"file":"git\/refs\/head.py","function":"Head.checkout"}]}],"references":null}