CVE-2026-42305: Dulwich arbitrary file write and RCE via NTFS-hostile tree entries

CVE-2026-42305 · Severity: high · CVSS 8.8 · Published 2026-06-10

Dulwich is a Python-based tool used to interact with Git repositories. A security flaw allows a malicious repository to write files to unauthorized locations on a user's computer when they download (clone) or update a project on Windows. This can be used to plant malicious scripts that run automatically, potentially giving an attacker full control over the victim's system.

Technologies: dulwich (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-42305 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-42305 being exploited in the wild.
How severe is CVE-2026-42305?
High severity, with a CVSS score of 8.8, published 10 June 2026.
Which products and versions are affected?
dulwich (PyPI) >= 0.10.0, < 1.2.5, ECOSYSTEM:introduced=0.10.0,fixed=1.2.5.
Is there a fix for CVE-2026-42305?
Yes. dulwich (PyPI): upgrade to 1.2.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-42305 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-42305?
Check whether you run 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

  • dulwich (PyPI): upgrade to 1.2.5 or later
    pip install "dulwich>=1.2.5"

Technical details

A path traversal vulnerability (CWE-22) exists in Dulwich's path-element validator. The validator fails to properly sanitize filenames containing Windows-specific structural characters such as backslashes (\), colons (:), and NTFS 8.3 short-name aliases (e.g., git~1). An attacker can craft a malicious repository with tree entries like '.git\hooks\pre-commit.exe' which, when cloned on Windows, bypasses directory restrictions to plant executable files inside the .git directory or escape the work tree. The risk was compounded by a bug where 'core.protectNTFS' and 'core.protectHFS' configuration settings were ignored due to a naming mismatch in the lookup logic. This issue is fixed in version 1.2.5, which enforces NTFS validation by default on all platforms.

Affected products

  • Jelmer Vernooij Dulwich >=0.10.0, <1.2.5

Identifiers

  • CVE-2026-42305
  • GHSA-897w-fcg9-f6xj
  • PYSEC-2026-2463

Timeline

  • 2026-05-28: patched: Version 1.2.5 released
  • 2026-05-28: advisory: GitHub Security Advisory GHSA-897w-fcg9-f6xj published
  • 2026-06-10: disclosed: CVE-2026-42305 published to NVD

References

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