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

Source: https://junglewise.ai/threats/cve-2026-42305-dulwich-arbitrary-file-write-and-rce-via-ntfs-hostile-tree  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-10. Updated: 2026-06-10  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/dulwich). Vendors: [PyPI](https://junglewise.ai/threats/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

  ```sh
  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 Vernooĳ 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

- [https://github.com/jelmer/dulwich/commit/49eb56e51aad637fc23d54bf2a08cb42739b8290](https://github.com/jelmer/dulwich/commit/49eb56e51aad637fc23d54bf2a08cb42739b8290)
- [https://github.com/jelmer/dulwich/commit/57efc4aa1581e038915a0fd79365be53b150f4a9](https://github.com/jelmer/dulwich/commit/57efc4aa1581e038915a0fd79365be53b150f4a9)
- [https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5](https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5)
- [https://github.com/jelmer/dulwich/security/advisories/GHSA-897w-fcg9-f6xj](https://github.com/jelmer/dulwich/security/advisories/GHSA-897w-fcg9-f6xj)

## Related threats

- [Dulwich arbitrary file write on Windows via unvalidated drive letters](https://junglewise.ai/threats/dulwich-arbitrary-file-write-rce-on-windows-via-unvalidated-drive-fc90311d)
- [Dulwich infinite loop denial of service in packfile object resolution](https://junglewise.ai/threats/dulwich-infinite-loop-denial-of-service-dos-in-packfile-object-d71acec7)
- [Dulwich symlink write-through in checkout via os.open](https://junglewise.ai/threats/dulwich-symlink-write-through-in-checkout-paths-via-raw-os-open-7e9ebad6)
- [Dulwich symlink directory traversal in filter-branch index_filter](https://junglewise.ai/threats/dulwich-symlink-directory-traversal-in-filter-branch-index-filter-via-c34daf58)
- [Dulwich symlink directory traversal in stash pop](https://junglewise.ai/threats/dulwich-symlink-directory-traversal-in-stash-pop-allows-arbitrary-file-12378d39)
