CVE-2026-42305: Dulwich Arbitrary File Write and Remote Code Execution on Windows
Dulwich, a Python library used to interact with Git repositories, contains a critical flaw in how it validates filenames when cloning or checking out repositories on Windows. An attacker can craft a malicious Git repository with specially crafted filenames that exploit Windows path syntax interpretation, allowing arbitrary files to be written to a system and potentially executing code. The vulnerability affects Dulwich versions 0.10.0 through 1.2.4 on Windows systems. Users on POSIX systems (Linux, macOS) are not directly vulnerable, but can inadvertently propagate malicious repositories to Windows users.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 8.8 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Weaknesses (CWE)
- CWE-22
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-10 / 2026-06-17
NVD description (verbatim)
Dulwich is a pure-Python implementation of the Git file formats and protocols. Versions starting with 0.10.0 and prior to 1.2.5 have an arbitrary file write leading to remote code execution when cloning or checking out a malicious Git repository on Windows. Dulwich's path-element validator accepted tree entries whose filenames contained bytes that Windows interprets as structural path syntax. Contributing configuration bugs made matters worse. The core.protectNTFS and core.protectHFS settings were looked up under a wrong option name and so user-set values were silently ignored, and core.protectNTFS only defaulted to true on Windows (Git upstream has defaulted it to true everywhere since CVE-2019-1353). Both have been corrected. Anyone who clones, fetches, or checks out an untrusted repository with Dulwich on Windows - either through the Dulwich CLI, porcelain.clone, or any downstream tool built on Dulwich - is impacted. POSIX clones are not directly exploitable (on POSIX \ is a literal filename byte), but a POSIX user can unknowingly propagate a malicious tree to Windows consumers via push or re-publication. This issue is fixed in Dulwich 1.2.5. Users should upgrade to 1.2.5 or later. There is no effective pre-patch workaround. On affected versions the core.protectNTFS configuration key was silently ignored, so setting it to true does not mitigate the issue. Users who cannot upgrade should avoid cloning, fetching, or checking out untrusted repositories with Dulwich on Windows. After upgrading the NTFS validator is on by default on every platform, so no additional configuration is required.
4 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-42305 stems from insufficient path validation in Dulwich's tree entry processing. The vulnerability has two root causes: (1) Dulwich's filename validator accepted tree entries containing bytes that Windows interprets as structural path syntax (such as colons, angle brackets, or asterisks), and (2) configuration options core.protectNTFS and core.protectHFS were checked under incorrect option names, causing user-set values to be silently ignored. Additionally, core.protectNTFS only defaulted to true on Windows, whereas Git upstream has defaulted it to true on all platforms since 2019. When a user clones, fetches, or checks out a repository containing maliciously-named files, Dulwich writes these files with their unvalidated names, enabling path traversal or direct writes to sensitive locations. The vulnerability is path-traversal-adjacent but is more accurately characterized as a filename normalization bypass specific to Windows NTFS semantics. Version 1.2.5 corrects both the validator logic and configuration handling, and enables NTFS-safe filename validation on all platforms by default.
Business impact
Organizations using Dulwich for automated Git operations face significant risk if developers or CI/CD pipelines clone or pull untrusted repositories on Windows machines. A successful exploit could result in unauthorized file creation, overwriting of legitimate files, or execution of arbitrary code in the context of the user running Dulwich. Development teams relying on Dulwich porcelain.clone() or CLI tools built atop Dulwich are particularly exposed. The remediation requirement is straightforward—upgrade to 1.2.5—but the window before patching is dangerous because existing configuration settings (core.protectNTFS=true) offer no protection due to the bug; users have no workaround and must avoid untrusted repositories entirely on Windows until upgraded.
Affected systems
Dulwich versions 0.10.0 through 1.2.4 are vulnerable on Windows. The vulnerability affects any tool or service built on Dulwich, including direct use of porcelain.clone(), fetch, or checkout operations, as well as any downstream application that wraps these functions. While POSIX systems (Linux, macOS) are not directly exploitable—because backslash is a literal filename character rather than a path separator in Unix—POSIX users can unknowingly pull or push malicious trees from/to a shared repository that is later cloned by Windows users. Systems with Python 3.x environments where Dulwich is installed and used for Git operations are in scope.
Exploitability
Exploitation requires user interaction (cloning or checking out a repository), but the barrier is low. An attacker distributes a malicious Git repository via any publicly accessible Git hosting platform or via social engineering to encourage developers to clone it. No special privileges are required on the victim's machine. The attack surface is broad: any Windows developer, CI/CD agent, or automated service using Dulwich to pull untrusted repositories is vulnerable. The CVSS score of 8.8 (HIGH) reflects the combination of network-based delivery, low complexity, low privilege requirement, and high impact across confidentiality, integrity, and availability. The user interaction requirement (cloning) prevents it from being CRITICAL, but the real-world likelihood is elevated because Git cloning is routine.
Remediation
Upgrade Dulwich to version 1.2.5 or later immediately. This release fixes both the path validation logic and the configuration option lookup bug, and enables NTFS-safe filename validation on all platforms by default. No configuration changes are required post-upgrade. Verify the upgrade with: `pip show dulwich` to confirm version 1.2.5+. For teams unable to upgrade immediately, the only effective mitigation is to prohibit cloning, fetching, or checking out untrusted repositories on Windows until the patch is applied. Attempting to set core.protectNTFS=true on vulnerable versions does not work due to the configuration bug.
Patch guidance
Update Dulwich using your standard Python package management process: `pip install --upgrade dulwich` will fetch version 1.2.5 or later. Verify the installation by running `python -c 'import dulwich; print(dulwich.__version__)'` and confirm it is 1.2.5 or higher. For vendored or pinned dependencies, update your requirements.txt, pyproject.toml, or equivalent to specify `dulwich>=1.2.5`. Patching is low-risk; the changes are confined to path validation and configuration handling with no breaking API changes. Test in a non-production environment first if running Dulwich in a critical CI/CD pipeline, but delays should be minimal given the severity.
Detection guidance
Monitor for Dulwich version usage in your environment via pip show, requirements audits, or software composition analysis (SCA) tools; flag any version <1.2.5. Enable logging or monitoring on Git cloning operations, especially those pulling from public or untrusted repositories on Windows machines. Look for unusual file creation patterns in temporary directories or user profile locations; an exploit may attempt to write files with names like `..\..\payload.exe` or files with reserved characters. Network-level detection is difficult because the attack is delivered via standard Git protocol; focus on endpoint-level file I/O monitoring. After patching, verify that core.protectNTFS is no longer in the configuration (or if present, that it is being honored); the default-safe behavior on all platforms post-1.2.5 eliminates reliance on manual configuration.
Why prioritize this
This vulnerability should be prioritized for immediate patching because: (1) it affects all Windows developers and automated systems using Dulwich, (2) exploitation is practical and requires only routine Git operations, (3) the impact is severe (arbitrary file write and RCE), (4) no workaround mitigates the risk, and (5) the patch is simple and low-risk. If your organization uses Dulwich directly or via a downstream tool, inventory affected systems and begin patching within 24–48 hours. Organizations with developer-focused or open-source ecosystems should prioritize even higher.
Risk score, explained
The CVSS 3.1 score of 8.8 (HIGH) reflects: Attack Vector Network (AV:N) because the malicious repository is delivered over the network; Attack Complexity Low (AC:L) because exploitation is straightforward filename manipulation; Privileges Required None (PR:N); User Interaction Required (UI:R) because the victim must clone/checkout; Scope Unchanged (S:U); and impact High across Confidentiality, Integrity, and Availability (arbitrary file write and code execution). The user interaction requirement prevents a CRITICAL rating, but the score appropriately reflects the practical danger. The emphasis on Windows systems does not reduce the baseline score but should increase organizational concern for Windows-heavy development teams.
Frequently asked questions
Is my POSIX (Linux/macOS) system vulnerable?
Not directly. On POSIX systems, backslash is a literal filename byte, not a path separator, so Dulwich does not interpret tree entries with backslashes as path traversal. However, if you clone a malicious repository on POSIX and push or publish it, Windows users who later clone the same repository will be vulnerable. Upgrade to 1.2.5 anyway to prevent becoming a vector for downstream Windows users.
I already set core.protectNTFS=true in my Git config. Am I safe?
No. On vulnerable Dulwich versions (0.10.0–1.2.4), the core.protectNTFS setting is silently ignored due to a configuration lookup bug. The setting is read under the wrong option name, so your manual configuration has no effect. Upgrade to 1.2.5 immediately; post-upgrade, NTFS protection is enabled by default on all platforms.
What is the difference between this and CVE-2019-1353?
CVE-2019-1353 (Git path traversal) led to the introduction of core.protectNTFS by Git upstream. That fix defaulted the protection to true on all platforms. Dulwich's vulnerability is similar in intent but distinct: Dulwich failed to implement the same default behavior and compounded the problem with a configuration bug. The fix in 1.2.5 aligns Dulwich with Git's upstream security posture.
Can I use Dulwich in a sandboxed environment to reduce risk?
Sandboxing may limit the impact of an exploit, but it does not prevent the code execution within the sandbox boundary. If the sandbox has access to sensitive data or credentials, the compromise is still severe. Upgrade to 1.2.5 rather than relying on sandboxing as a mitigation.
This analysis is provided for informational purposes and reflects publicly available information as of the publication date. The vulnerability details, affected versions, and patch status are based on the CVE record and vendor disclosures. Organizations should verify patch availability and compatibility within their specific environment. Testing in a non-production environment prior to production patching is recommended. This page does not constitute legal or compliance advice. Consult your security team and vendor advisories for definitive remediation guidance. Source: NVD (public-domain), retrieved 2026-07-20. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2016-20076HIGHWordPress Simple-Backup 2.7.11 Unauthenticated File Access & Deletion Vulnerability
- CVE-2016-20081HIGHHB Audio Gallery Lite Path Traversal Vulnerability – Unauthenticated File Download
- CVE-2017-20248HIGHApptha Slider Gallery Path Traversal Vulnerability
- CVE-2017-20250HIGHMac Photo Gallery 3.0 Path Traversal File Download Vulnerability
- CVE-2018-25408HIGHOpen ISES Project Path Traversal Vulnerability (High Severity)
- CVE-2024-40646HIGHVertex Path Traversal Vulnerability – Remote File Access Risk
- CVE-2026-0270HIGHCortex XSOAR Path Traversal on Linux — Exploit Requirements & Patching Guide
- CVE-2026-10108HIGHUnauthenticated Path Traversal in xiaomusic v0.5.7 – File Read Vulnerability