CVE-2026-42305: Dulwich Dulwich Has An Arbitrary File Vulnerability
HIGHCVE-2026-42305 is a HIGH (CVSS 8.8) dulwich has an arbitrary file vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Dulwich libraries in the PyPI ecosystem. The issue involves dulwich has an arbitrary file write via ntfs-hostile tree entries on windows. Remediation is available by upgrading affected packages to version 1.2.5.
CVE-2026-42305 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-42305
To remediate this vulnerability, upgrade all affected Dulwich dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install dulwich>=1.2.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show dulwich
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-42305, inspect your installed packages using pip:
pip show dulwich
Analyze the terminal output to locate any version of Dulwich in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.5), your application is affected.
Note: The pip show dulwich command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Dulwich, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-42305 Affected Dulwich Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dulwich
|
PyPI |
≥ 0.10.0
< 1.2.5
|
1.2.5
|
References
Frequently Asked Questions
What is CVE-2026-42305?
Which Dulwich versions are affected?
What version fixes CVE-2026-42305?
Is dulwich affected?
What is the CVSS score of CVE-2026-42305?
What CWE is associated with CVE-2026-42305?
How can I check PyPI dependencies for CVE-2026-42305?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-897w-fcg9-f6xj",
"modified" : "2026-06-11T14:05:10Z",
"published" : "2026-05-28T22:28:06Z",
"aliases" : [ "CVE-2026-42305" ],
"summary" : "Dulwich has an arbitrary file write via NTFS-hostile tree entries on Windows",
"details" : "## Impact\n\nArbitrary file write leading to remote code execution when cloning or checking out a malicious Git repository on Windows.\n\nDulwich's path-element validator accepted tree entries whose filenames contained bytes that Windows interprets as structural path syntax:\n\n - \\ — the Windows path separator. A single tree entry named .git\\hooks\\pre-commit.exe was treated as one valid filename on POSIX but materialized as nested directories .git/hooks/pre-commit.exe on Windows, planting a file inside the victim's .git directory. Git for Windows then\n executes that hook on the next git commit, giving the attacker arbitrary code execution in the victim's user context. The same primitive can be used with ..\\outside.txt to escape the work tree.\n - : — the NTFS alternate-data-stream marker. .git::$INDEX_ALLOCATION writes directly into the victim's .git entity, bypassing the .git-as-a-directory check.\n - git~<digits> — NTFS 8.3 short-name aliases of .git. Only the literal git~1 was rejected; git~2, git~10, GIT~1, etc. were all accepted.\n\nContributing 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.\n\nAnyone 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.\n\n## Patches\n\nFixed in Dulwich 1.2.5. Users should upgrade to 1.2.5 or later.\n\nThe fix lives in three commits:\n\n- Read core.protectNTFS / core.protectHFS under their documented option names so user-set values are honored.\n- Default core.protectNTFS to true on every platform, matching Git's PROTECT_NTFS_DEFAULT=1.\n- Reject \\, :, and all git~<digits> 8.3 short-name forms in validate_path_element_ntfs.\n\n## Workarounds\n\nThere 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.\n\n## Resources\n\n- Git upstream path validation: https://github.com/git/git/blob/master/path.c (is_ntfs_dotgit, verify_path)\n- CVE-2019-1353 — the Git upstream vulnerability that established core.protectNTFS = true as the cross-platform default\n- CVE-2019-1354 — backslash-in-tree-path class in Git, analogous to this issue",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "dulwich"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.10.0"
}, {
"fixed" : "1.2.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/jelmer/dulwich/security/advisories/GHSA-897w-fcg9-f6xj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42305"
}, {
"type" : "WEB",
"url" : "https://github.com/jelmer/dulwich/commit/49eb56e51aad637fc23d54bf2a08cb42739b8290"
}, {
"type" : "WEB",
"url" : "https://github.com/jelmer/dulwich/commit/57efc4aa1581e038915a0fd79365be53b150f4a9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jelmer/dulwich"
}, {
"type" : "WEB",
"url" : "https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-28T22:28:06Z",
"nvd_published_at" : "2026-06-10T23:16:46Z"
}
}