Poetry: Dulwich: Symlink directory traversal in filter-branch index_filter via cross-commit state persistence
Description
Dulwich's filter_branch.py in Poetry versions 2.2.0 up to but not including 2.4.2 contains a symlink directory traversal vulnerability in the CommitFilter._apply_index_filter() function. This occurs because materialized tree entries, including symlinks, persist in the working directory between commits, allowing an attacker to redirect file writes to arbitrary filesystem locations. An attacker can exploit this by crafting a malicious repository that causes filter_branch to write attacker-controlled content to arbitrary locations, potentially achieving remote code execution if writes target .git/hooks/. A fix is available that involves cleaning the working directory between commit iterations or verifying symlinks before writing files.
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 exists in Dulwich's filter_branch.py _apply_index_filter() method, which materializes tree entries to the current working directory without cleaning up symlinked files between commits. Ancestor commit symlinks persist and can redirect writes from descendant commits to arbitrary filesystem paths. This allows an attacker to craft a repository where running filter_branch with an index filter writes attacker-controlled content to arbitrary locations, including .git/hooks/, enabling remote code execution. The root cause is that only the temporary index file is deleted, not the materialized files, and no symlink protections exist in build_file_from_blob(). The vulnerability affects Poetry versions >=2.2.0 and <2.4.2. A patch is available to clean the working directory or verify symlinks before writing.
Potential Impact
An attacker who controls a malicious repository can cause the filter_branch operation to write arbitrary files to arbitrary filesystem locations on the victim's machine by exploiting symlink traversal. This can lead to remote code execution if the attacker writes to locations such as .git/hooks/. The vulnerability requires the victim to run filter_branch with an index filter on the malicious repository. The CVSS 3.1 score is 8.6 (high severity) indicating high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
A fix is available for this vulnerability. Users should upgrade Poetry to a patched version at or above 2.4.2 where the working directory is cleaned between commit iterations or symlink checks are implemented before writing files. Until patched, avoid running filter_branch with index filters on untrusted repositories. Follow the vendor's official update guidance to remediate this issue.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-poetry-GHSA-5fqc-mrg8-w798
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6ac2457d12601ec6a316405f
Added to database: 10/04/2026, 12:24:29 UTC
Last enriched: 10/04/2026, 12:28:38 UTC
Last updated: 10/04/2026, 12:28:38 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.