Dulwich Path Traversal and DoS Vulnerabilities
2026-10-21
Arbitrary file write in Dulwich before 1.2.9 on Windows can be escalated to remote code execution when an unauthenticated remote attacker convinces a victim or an automated Windows CI runner to clone or check out a malicious repository. A crafted Git tree entry whose name is a DOS drive-letter prefix such as 'C:' passes NTFS validation and causes os.path.join to discard the intended worktree root, allowing writes to locations like the user's .gitconfig or Startup folder. A proof-of-concept generator is described in the vendor advisory, so publicly available exploit code exists.
Symlink-based path traversal in Dulwich 0.23.1 through 1.2.7 allows an attacker who controls a repository's commit history to write files outside the working directory when a victim runs filter_branch with an index_filter, with code execution possible if the write lands in .git/hooks. Exploitation is conditional: it requires local access and the victim to invoke the history-rewriting operation against the crafted repository, and no public exploit code was identified at time of analysis. Dulwich 1.2.8 fixes the issue by addressing cross-commit symlink persistence.
Path-restricted checkout in Dulwich 0.24.0 through 1.2.7 follows symlinks when writing restored files, so a crafted repository can redirect a selective checkout into arbitrary filesystem locations - including .git/hooks/post-checkout - to plant an executable hook and achieve code execution. Exploitation is conditional: the victim must obtain an attacker-controlled repository whose worktree entry is a symlink (mode 120000) pointing at a sensitive path, then explicitly call porcelain.checkout(paths=[...]) against a tag or ref where that same path is a regular executable blob; a plain clone or default full checkout does not trigger it. No public exploit code has been identified at time of analysis, and the issue is fixed in Dulwich 1.2.8.
Arbitrary file write leading to potential code execution affects Dulwich 0.22.5 through 1.2.7 when a victim pops a stash in an attacker-crafted repository, because intermediate directory symlinks are followed and can redirect writes into .git/hooks/post-checkout. Exploitation requires local operation of the affected library plus a multi-step stash workflow and a subsequent checkout, so this is a conditional code-execution risk rather than a drive-by remote compromise; no public exploit code was identified at time of analysis. Dulwich 1.2.8 contains the vendor fix.
Dulwich before 1.2.9 can be driven into an infinite recursion loop by a crafted packfile containing an OFS_DELTA object whose delta_offset is 0, causing CPU exhaustion during clone, fetch, cat-file, or internal object lookups. The flaw is availability-only and requires the victim or service to process an attacker-supplied packfile; publicly available exploit code exists.