Dulwich symlink write-through in checkout via os.open

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

Dulwich is a Python library for interacting with Git repositories. An attacker can craft a malicious Git repository that, when a victim clones and runs checkout operations on specific paths, writes arbitrary files outside the intended worktree directory—such as into Git hook scripts—leading to remote code execution when those hooks are triggered.

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 <UNKNOWN>; dulwich (PyPI) >= 0.24.0, <= 1.2.7.
Is there a fix for This vulnerability?
No fixed version is recorded yet. Avoid calling porcelain.checkout(paths=[...]) on untrusted repositories, or restrict Git operations to sandboxed environments until patching is available. 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 over the network, 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

Avoid calling porcelain.checkout(paths=[...]) on untrusted repositories, or restrict Git operations to sandboxed environments until patching is available.

Technical details

Dulwich's porcelain.checkout(paths=[...]) code path uses raw os.open() with O_WRONLY|O_CREAT|O_TRUNC without O_NOFOLLOW, allowing symlink traversal even though _checked_worktree_path() performs name validation only. An attacker can plant a symlink in the repository (e.g., pointing to .git/hooks/post-checkout) and then cause a victim to write attacker-controlled file contents to it, achieving arbitrary file write and code execution. The vulnerability bypasses all existing symlink protections in the affected code path.

Affected products

  • Dulwich Dulwich <UNKNOWN>

Timeline

  • 2026-10-02: disclosed

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