{"id":"CVE-2026-114098","aliases":["CVE-2026-114098","GHSA-cm62-gvxx-vmxx"],"related":[],"kind":"vulnerability","state":"published","title":"Dulwich 0.22.5 before 1.2.8 Path Traversal via Stash Pop Symlinks","summary":"Dulwich from 0.22.5 before 1.2.8 contains a path traversal vulnerability in stash.py pop() that allows attackers to write arbitrary files outside the worktree through intermediate directory symlinks. Attackers can craft a malicious repository whose popped stash writes a payload into .git/hooks/post-checkout, achieving code execution on the next checkout.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Dulwich from 0.22.5 before 1.2.8 contains a path traversal vulnerability in stash.py pop() that allows attackers to write arbitrary files outside the worktree through intermediate directory symlinks. Attackers can craft a malicious repository whose popped stash writes a payload into .git/hooks/post-checkout, achieving code execution on the next checkout.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nDulwich's `stash.py:pop()` function is vulnerable to symlink directory traversal, allowing an attacker to write arbitrary files outside the repository worktree when a victim pops a stash in a malicious repository.\n\n## Root Cause\n\nThe `pop()` function at `dulwich/stash.py:236` uses `os.path.exists(parent_dir)` to check if a parent directory exists before writing stashed files. `os.path.exists()` follows symlinks, so when an intermediate directory in the path is a symlink pointing outside the worktree (e.g., `link → ../../.git/hooks`), the check passes and subsequent file writes resolve through the symlink.\n\nThe `validate_path()` function (line 228) only validates path component names against `INVALID_DOTNAMES` — it performs zero filesystem symlink detection. On dulwich 1.2.7 (latest release), `build_file_from_blob()` has no symlink protection whatsoever.\n\n## Impact\n\nAn attacker can craft a malicious repository that, when a victim clones it and performs a stash pop operation, writes attacker-controlled content to arbitrary filesystem locations. Writing to `.git/hooks/post-checkout` achieves Remote Code Execution on the victim's machine on the next git checkout operation.\n\n## Attack Scenario\n\n1. Attacker creates a repository with branch `main` containing `link` (symlink → `../../.git/hooks`) and branch `feature` containing `link/post-checkout` (executable payload)\n2. Victim clones the repository (landing on `main` — symlink `link` exists in worktree)\n3. Victim checks out `feature`, makes changes, runs `stash.push()`\n4. Victim checks out `main` (restoring the `link` symlink)\n5. Victim runs `stash.pop(0)` — stash contains `link/post-checkout`\n6. `os.path.exists(\"link\")` returns True (symlink to existing directory), `os.makedirs` skipped\n7. `build_file_from_blob(blob, mode, \"link/post-checkout\")` → `open(\"link/post-checkout\", \"wb\")` follows the intermediate symlink → payload written to `.git/hooks/post-checkout`\n8. Next checkout operation triggers the hook → RCE\n\n## Suggested Fix\n\nBefore writing any file, verify that no component of the target path resolves through a symlink outside the worktree. Use `os.path.realpath(parent_dir)` and confirm it stays within the repository root. Alternatively, use `os.open()` with `O_NOFOLLOW` on each path component.\n\nReported by **zx (Jace)**","format":"markdown","source":"ghsa"}],"published":"2026-10-02T18:52:53.000Z","modified":"2026-10-27T22:17:25.090Z","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.22.5","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.22.5","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-cm62-gvxx-vmxx","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/dulwich-0.22.5-before-1.2.8-path-traversal-via-stash-pop-symlinks","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/jelmer/dulwich/commit/40a542cb02f9ac39a9eeac1193472903098698f9","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-27T21:53:59.243Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-114098","url":"https://www.cve.org/CVERecord?id=CVE-2026-114098","licence":"CVE Terms of Use","modified":"2026-10-27T21:54:10.359Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cm62-gvxx-vmxx","url":"https://github.com/advisories/GHSA-cm62-gvxx-vmxx","licence":"CC-BY-4.0","modified":"2026-10-21T10:57:23.057Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-114098","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-114098","licence":"Public domain","modified":"2026-10-27T22:17:25.090Z"}],"updatedAt":"2026-11-25T22:59:46.542Z","epss":{"score":0.00186,"percentile":0.08618,"date":"2026-12-01T12:00:22.000Z"}}