Poetry: Dulwich: Symlink write-through in checkout(paths=[]) via raw os.open bypasses all symlink protections
Description
Dulwich's porcelain.checkout(paths=[...]) function uses raw os.open calls that follow symlinks, bypassing symlink protections and allowing arbitrary file writes. An attacker can craft a malicious repository with symlinks that cause checkout to overwrite files such as .git/hooks/post-checkout, enabling remote code execution on subsequent git operations. The vulnerability affects Poetry versions from 2.2.0 up to but not including 2.4.2. A patch is available to fix this issue by replacing the raw os.open usage with a safer method that detects symlinks.
CVSS v3.1
Score 8.6high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises because Dulwich's porcelain.checkout(paths=[...]) implementation writes files using raw os.open without O_NOFOLLOW, which follows symlinks at both the target and intermediate directories. The path validation only checks for invalid names but does not detect symlinks. This allows an attacker to craft a repository where a symlink points to sensitive locations like .git/hooks/post-checkout. When a victim runs checkout with that path, the malicious payload is written to the hook file, leading to remote code execution on the next checkout. The suggested fix is to replace the raw os.open call with a hardened build_file_from_blob function or add explicit symlink detection to ensure the path stays within the worktree root.
Potential Impact
An attacker can cause arbitrary file writes with attacker-controlled content and permissions to any location accessible by the user running the checkout. This can lead to remote code execution by overwriting git hook scripts such as .git/hooks/post-checkout. The vulnerability compromises confidentiality, integrity, and availability of the affected system.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade Poetry to a fixed version at or beyond 2.4.2. Until patched, avoid running checkout(paths=[...]) on untrusted repositories. The vendor advisory recommends replacing raw os.open usage with a hardened function that detects symlinks or adding explicit symlink detection and path resolution to ensure files are written only within the worktree.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-poetry-GHSA-8w8g-wq8h-fq33
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6ac2457d12601ec6a316405e
Added to database: 10/04/2026, 12:24:29 UTC
Last enriched: 10/04/2026, 12:28:28 UTC
Last updated: 10/04/2026, 12:28:28 UTC
Views: 2
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.