dulwich

CVE-2026-42305

CVE-2026-42305 is a high-severity path traversal vulnerability in dulwich (pip), affecting versions >= 0.10.0, < 1.2.5. It is fixed in 1.2.5.

Key facts
CVSS score
8.8
High
Attack vector
Network
Issuing authority
GitHub Advisory Database
Affected package
dulwich
Fixed in
1.2.5
Disclosed
2026

Summary

Impact 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: \, 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 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. :, the NTFS alternate-data-stream marker. .git::$INDEXALLOCATION writes directly into the victim's .git entity, bypassing the .git-as-a-directory check. 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. 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. Patches Fixed in Dulwich 1.2.5. Users should upgrade to 1.2.5 or later. The fix lives in three commits: Read core.protectNTFS / core.protectHFS under their documented option names so user-set values are honored. Default core.protectNTFS to true on every platform, matching Git's PROTECTNTFSDEFAULT=1. Reject \, :, and all git~<digits> 8.3 short-name forms in validatepathelementntfs. Workarounds 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. Resources Git upstream path validation: https://github.com/git/git/blob/master/path.c (isntfsdotgit, verify_path) CVE-2019-1353, the Git upstream vulnerability that established core.protectNTFS = true as the cross-platform default CVE-2019-1354, backslash-in-tree-path class in Git, analogous to this issue

Impact

What is path traversal?

Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.

Severity and exposure

CVE-2026-42305 has a CVSS score of 8.8 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.

A fixed version is available (1.2.5). Upgrading removes the vulnerable code path.

Affected versions

pip

  • dulwich (>= 0.10.0, < 1.2.5)

Security releases

  • dulwich → 1.2.5 (pip)
Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.

Kodem's runtime-powered SCA identifies whether CVE-2026-42305 is reachable in your applications. Explore open-source security for your team.

See if CVE-2026-42305 is reachable in your applications. Get a demo

Already deployed Kodem? See CVE-2026-42305 in your environment

Remediation advice

Upgrade dulwich to 1.2.5 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently asked questions about CVE-2026-42305

What is CVE-2026-42305?

CVE-2026-42305 is a high-severity path traversal vulnerability in dulwich (pip), affecting versions >= 0.10.0, < 1.2.5. It is fixed in 1.2.5. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.

How severe is CVE-2026-42305?

CVE-2026-42305 has a CVSS score of 8.8 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.

Which versions of dulwich are affected by CVE-2026-42305?

dulwich (pip) versions >= 0.10.0, < 1.2.5 is affected.

Is there a fix for CVE-2026-42305?

Yes. CVE-2026-42305 is fixed in 1.2.5. Upgrade to this version or later.

Is CVE-2026-42305 exploitable, and should I be worried?

Whether CVE-2026-42305 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo

What actually determines whether CVE-2026-42305 is exploitable, and how bad it is?

Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.

How do I fix CVE-2026-42305?

Upgrade dulwich to 1.2.5 or later.

Stop the waste.
Protect your environment with Kodem.