Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. dulwich
  4. ›
  5. CVE-2026-42305

CVE-2026-42305: Dulwich has an arbitrary file write via NTFS-hostile tree entries on Windows

May 28, 2026 (updated June 11, 2026)

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::$INDEX_ALLOCATION writes directly into the victim’s .git entity, bypassing the .git-as-a-directory check.
  • git~ — NTFS 8.3 short-name aliases of .git. Only the literal git1 was rejected; git2, git10, GIT1, 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.

References

  • github.com/advisories/GHSA-897w-fcg9-f6xj
  • github.com/jelmer/dulwich/commit/49eb56e51aad637fc23d54bf2a08cb42739b8290
  • github.com/jelmer/dulwich/commit/57efc4aa1581e038915a0fd79365be53b150f4a9
  • github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5
  • github.com/jelmer/dulwich/security/advisories/GHSA-897w-fcg9-f6xj
  • nvd.nist.gov/vuln/detail/CVE-2026-42305

Code Behaviors & Features

Detect and mitigate CVE-2026-42305 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.10.0 before 1.2.5

Fixed versions

  • 1.2.5

Solution

Upgrade to version 1.2.5 or above.

Impact 8.8 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Source file

pypi/dulwich/CVE-2026-42305.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:23:38 +0000.