Dulwich symlink directory traversal in stash pop

Severity: high · CVSS 8.6 · Published 2026-10-02

Dulwich is a Python library for interacting with Git repositories. A flaw in its stash pop feature allows an attacker to write malicious files outside the repository through symlink directory traversal, potentially enabling remote code execution if the attacker writes to Git hook directories. This occurs when a victim clones a malicious repository and pops a stash containing symlink-based path traversal payloads.

Technologies: Dulwich, dulwich (PyPI). Vendors: Dulwich, PyPI.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
High severity, with a CVSS score of 8.6, published 2 October 2026.
Which products and versions are affected?
Dulwich 1.2.7 and earlier; dulwich (PyPI) >= 0.22.5, <= 1.2.7.
Is there a fix for This vulnerability?
No fixed version is recorded yet. Do not perform stash pop operations in repositories from untrusted sources until patched. Restrict clone and stash operations to trusted repositories, or use Dulwich in an isolated environment without write access to sensitive directories like .git/hooks.</anigation> </invoke> If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.
How is This vulnerability attacked?
It is attacked with local access, in a software library.
Am I affected?
Check whether you run Dulwich or dulwich (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

Do not perform stash pop operations in repositories from untrusted sources until patched. Restrict clone and stash operations to trusted repositories, or use Dulwich in an isolated environment without write access to sensitive directories like .git/hooks.</anigation> </invoke>

Technical details

The vulnerability exists in dulwich/stash.py:pop() where os.path.exists() follows symlinks without detecting whether intermediate path components traverse outside the repository root. The validate_path() function only checks dotnames but performs no symlink detection. An attacker can craft a repository with intermediate symlink directories (e.g., link → ../../.git/hooks) that bypass the parent directory existence check and cause file writes to resolve through those symlinks to arbitrary filesystem locations.

Affected products

  • Dulwich Dulwich 1.2.7 and earlier

Timeline

  • 2026-10-02: disclosed

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.