HighCVE
Dulwich: Symlink write-through in checkout(paths=[]) via raw os.open bypasses all symlink protections
GitHub Security Advisories·Source published ·1 min read
What happened?
Summary Dulwich's porcelain.checkout(paths=[...]) code path writes files using raw os.open(file_path, O_WRONLY|O_CREAT|O_TRUNC, mode) followed by f.write(obj.data). This code path does NOT call build_file_from_blob() at all, completely bypassing any symlink protections (including the unreleased d09f8af fix). os.open without O_NOFOLLOW follows symlinks at both the target file and intermediate directories, allowing arbitrary file writes.
Key details
- The vulnerable code path writes files directly without calling build_file_from_blob, skipping symlink checks.
- An attacker can craft a malicious repository that writes arbitrary content to any location accessible to the user.
- Writing to .git/hooks/post-checkout enables remote code execution on the next git checkout operation.
- The attack uses a symlink in HEAD pointing to .git/hooks/post-checkout and a malicious executable file in a tag.
- _checked_worktree_path only validates path names and performs zero filesystem symlink detection.
- The suggested fix is to replace raw os.open with build_file_from_blob or add explicit symlink detection using os.path.realpath.
What is affected?
- Dulwich versions 0.24.0 through 1.2.7 are affected.
Summarised by SecOraLens from GitHub Security Advisories. Always read the original source before acting. How SecOraLens verifies advisories.
What to do next
Hunt for this in your environmentPick a hypothesis, see where it sits on the MITRE ATT&CK model and get ready-to-run Sigma, Splunk, Sentinel and Elastic queries. Free to try.Open the Threat-Hunt Workbench →Get advisories like this by emailNew advisories delivered as they publish, each traced to its original source. Unsubscribe any time.Subscribe →Using this for a team?Paid plans add detection content, the full workbench and archive search. Not sure which fits? Ask us for a walkthrough.See plans →
For CISOs and SOC leads
Brief your board. Brief your team.
Executive risk briefs for governance, technical kill-chains for the SOC — delivered as advisories publish. Critical alerts within 1 hour. No spam, unsubscribe anytime.
