{"id":"CVE-2026-73621","aliases":["CVE-2026-73621","GHSA-p538-c434-8v24","PYSEC-2026-3950"],"related":[],"kind":"vulnerability","state":"published","title":"GitPython before 3.1.56 Arbitrary File Truncation via Commit.count","summary":"GitPython before 3.1.56 contains an argument injection vulnerability in the Commit.count() method, which forwards keyword arguments to 'git rev-list' without the check_unsafe_options guard present in the sibling iter_items method. An attacker who can control options passed to Commit.count (e.g., via an application that forwards a user-supplied options dict) can supply output=<path>, causing 'git rev-list --output=<path>' to open and truncate the target file to zero bytes before revision parsing. This allows destruction/blanking of an arbitrary file at the process's privilege level (no content control, 0-byte truncation).","summarySource":"cvelist","descriptions":[{"lang":"en","text":"GitPython before 3.1.56 contains an argument injection vulnerability in the Commit.count() method, which forwards keyword arguments to 'git rev-list' without the check_unsafe_options guard present in the sibling iter_items method. An attacker who can control options passed to Commit.count (e.g., via an application that forwards a user-supplied options dict) can supply output=<path>, causing 'git rev-list --output=<path>' to open and truncate the target file to zero bytes before revision parsing. This allows destruction/blanking of an arbitrary file at the process's privilege level (no content control, 0-byte truncation).","source":"cvelist"},{"lang":"en","text":"## Summary\n`Commit.count()` forwards `**kwargs` into `rev_list` with **no** `check_unsafe_options` guard (the guard exists only in the sibling `iter_items`, commit.py:341). `git rev-list --output=<path>` opens and truncates the target file to 0 bytes before revision parsing, so `count(output='/victim')` destroys/blanks an arbitrary file.\n\n## Root Cause\n`commit.py:290-291` calls `self.repo.git.rev_list(self.hexsha, **kwargs)` with no `check_unsafe_options` and no `allow_unsafe_options` parameter. The sibling `iter_items` (commit.py:341) is guarded; `count` is not. This is a distinct, uncovered sink — GHSA-956x-8gvw-wg5v fixed `iter_commits`/`blame`, not `count`.\n\n## Impact\nDestroy/blank an arbitrary file at process privilege (integrity/availability). Reachability is key-control only (`count` uses `self.hexsha`, not a user ref), and the write is a 0-byte truncation (no content control), so MEDIUM.\n\n## Proof of Concept\n```python\ncommit.count(output='/path/to/victim')   # victim truncated to 0 bytes (verified)\n# control: commit.iter_commits(output=...) raises UnsafeOptionError\n```\n\n## Attack Chain\n1. Entry: app forwards user options -> `commit.count(output='/victim')`. Guard: none. Bypass proof: `iter_commits(output=)` raises UnsafeOptionError; `count(output=)` does not — verified side-by-side.\n2. Sink: `git rev-list <sha> --output=/victim` -> file truncated to 0 bytes. Impact: destroy/blank arbitrary file.\n\n## Bypass Evidence\nLive-verified on HEAD (tag 3.1.53): `count(output=<victim>)` truncated a pre-existing file to 0 bytes; guarded `iter_commits(output=)` raised UnsafeOptionError. Same CNA-accepted \"app forwards user options dict\" model as GHSA-956x-8gvw-wg5v's `archive(**kwargs)`. Uncovered sink, not a duplicate.\n\n## Affected Versions\n`<= 3.1.53`\n\n## Suggested Fix\nAdd `check_unsafe_options` to `Commit.count` (mirroring `iter_items`).\n\n---\nReported by **zx (Jace)** — GitHub: @manus-use","format":"markdown","source":"ghsa"},{"lang":"es","text":"GitPython anterior a la versión 3.1.56 contiene una vulnerabilidad de inyección de argumentos en el método Commit.count(), que reenvía argumentos de palabra clave a ’git rev-list’ sin la protección check_unsafe_options presente en el método hermano iter_items. Un atacante que puede controlar las opciones pasadas a Commit.count (por ejemplo, a través de una aplicación que reenvía un diccionario de opciones proporcionado por el usuario) puede proporcionar output=[path], lo que hace que ’git rev-list --output=[path]’ abra y trunque el archivo objetivo a cero bytes antes del análisis de revisión. Esto permite la destrucción/borrado de un archivo arbitrario al nivel de privilegio del proceso (sin control de contenido, truncamiento a 0 bytes).","source":"nvd"}],"published":"2026-08-03T20:23:17.000Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"}],"cwes":["CWE-88"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.1.56","status":"affected"},{"type":"semver","version":"3.1.56","status":"unaffected"}],"vendor":"gitpython-developers","product":"GitPython","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.56"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.56"}],"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.56"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"pysec"}],"references":[{"url":"https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-p538-c434-8v24","tags":["evidence","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/gitpython-before-arbitrary-file-truncation-via-commit-count","tags":["advisory","third-party-advisory"],"sources":["cvelist","nvd","pysec"]},{"url":"https://github.com/gitpython-developers/GitPython/pull/2184","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gitpython-developers/GitPython/commit/38553b6fddc7f6a667cdb45a6762343a08fc72b2","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gitpython-developers/GitPython","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/gitpython-developers/GitPython/releases/tag/3.1.56","tags":["web"],"sources":["ghsa"]}],"credits":["manus-use"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-14T18:02:51.509Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-73621","url":"https://www.cve.org/CVERecord?id=CVE-2026-73621","licence":"CVE Terms of Use","modified":"2026-10-08T15:24:41.812Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p538-c434-8v24","url":"https://github.com/advisories/GHSA-p538-c434-8v24","licence":"CC-BY-4.0","modified":"2026-09-10T13:10:55.177Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-73621","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73621","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3950","url":"https://osv.dev/vulnerability/PYSEC-2026-3950","licence":"CC-BY-4.0","modified":"2026-09-10T13:00:04.116Z"}],"updatedAt":"2026-11-25T22:59:32.708Z","epss":{"score":0.00211,"percentile":0.11944,"date":"2026-12-01T12:00:22.000Z"}}