{"id":"CVE-2026-114097","aliases":["CVE-2026-114097","GHSA-5fqc-mrg8-w798"],"related":[],"kind":"vulnerability","state":"published","title":"Dulwich 0.23.1 before 1.2.8 Symlink Path Traversal via filter_branch Index Filter","summary":"Dulwich from 0.23.1 before 1.2.8 contains a path traversal vulnerability in CommitFilter._apply_index_filter() that allows attackers to write files outside the working directory via symlinks persisting between commits. Attackers can craft a repository where an ancestor commit's symlink redirects a descendant commit's file writes during filter_branch, enabling code execution by writing into .git/hooks.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Dulwich from 0.23.1 before 1.2.8 contains a path traversal vulnerability in CommitFilter._apply_index_filter() that allows attackers to write files outside the working directory via symlinks persisting between commits. Attackers can craft a repository where an ancestor commit's symlink redirects a descendant commit's file writes during filter_branch, enabling code execution by writing into .git/hooks.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nDulwich's `filter_branch.py` `CommitFilter._apply_index_filter()` is vulnerable to symlink directory traversal. When processing commit history, materialized tree entries (including symlinks) persist in the working directory between commits, allowing a symlink from an ancestor commit to redirect file writes from a descendant commit to arbitrary filesystem locations.\n\n## Root Cause\n\n`_apply_index_filter()` at `dulwich/filter_branch.py:212` calls `build_index_from_tree(\".\", tmp_index_path, ...)` which materializes all tree entries to the current working directory. The `finally` block (line 229-230) only cleans up the temporary index file (`os.unlink(tmp_index_path)`) — NOT the filesystem files written to CWD. When `process_commit()` processes parents recursively first (line 260), files materialized from ancestor commits persist and affect processing of descendant commits.\n\nOn dulwich 1.2.7, `build_file_from_blob()` has no symlink protection, and `validate_path_element` only validates name patterns, not filesystem state.\n\n## Impact\n\nAn attacker can craft a malicious repository where running `filter_branch` with an index filter writes attacker-controlled content to arbitrary filesystem locations via symlink traversal. This achieves RCE if the write targets `.git/hooks/`.\n\n## Attack Scenario\n\n1. Attacker creates a repository where commit history (linearized) has:\n   - Ancestor commit: tree entry `evil` (mode 120000, symlink → `/target_dir`)\n   - Descendant commit: tree entry `evil/payload` (mode 100644, attacker content)\n2. Victim clones repository and runs `filter_branch` with an index filter\n3. `process_commit()` processes ancestor first → materializes `evil` as symlink to `/target_dir` in CWD\n4. CWD is NOT cleaned between commits\n5. Processing descendant: `os.path.exists(\"./evil\")` → True (symlink exists). `build_file_from_blob(blob, mode, \"./evil/payload\")` → `open(\"./evil/payload\", \"wb\")` follows intermediate symlink → writes to `/target_dir/payload`\n\n## Suggested Fix\n\nClean the CWD between commit iterations in `_apply_index_filter()`, or verify that no intermediate path components are symlinks before writing files.\n\nReported by **zx (Jace)**","format":"markdown","source":"ghsa"}],"published":"2026-10-02T18:53:05.000Z","modified":"2026-10-22T16:17:34.150Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.3,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.3,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":8.6,"rating":"HIGH"}],"cwes":["CWE-22","CWE-59"],"affected":[{"ranges":[{"type":"semver","introduced":"0.23.1","fixed":"1.2.8","status":"affected"},{"type":"semver","version":"1.2.8","status":"unaffected"}],"vendor":"jelmer","product":"dulwich","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.23.1","status":"affected","fixed":"1.2.8"}],"ecosystem":"PyPI","package":"dulwich","purl":"pkg:pypi/dulwich","source":"ghsa"}],"references":[{"url":"https://github.com/jelmer/dulwich/security/advisories/GHSA-5fqc-mrg8-w798","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/dulwich-0.23.1-before-1.2.8-symlink-path-traversal-via-filter-branch-index-filter","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/jelmer/dulwich/commit/9571ac60b851fce228dae7ededb380c6ce9b3fb8","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/jelmer/dulwich","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.8","tags":["web"],"sources":["ghsa"]}],"credits":["manus-use","jelmer"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-22T15:51:27.066Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-114097","url":"https://www.cve.org/CVERecord?id=CVE-2026-114097","licence":"CVE Terms of Use","modified":"2026-10-22T15:51:35.497Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5fqc-mrg8-w798","url":"https://github.com/advisories/GHSA-5fqc-mrg8-w798","licence":"CC-BY-4.0","modified":"2026-10-21T10:57:27.569Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-114097","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-114097","licence":"Public domain","modified":"2026-10-22T16:17:34.150Z"}],"updatedAt":"2026-11-25T22:59:46.542Z","epss":{"score":0.00186,"percentile":0.08618,"date":"2026-12-01T12:00:22.000Z"}}