Skip to main content

Poetry: Dulwich: Symlink directory traversal in stash pop allows arbitrary file write via intermediate directory symlinks

0
High
Published: 10/04/2026 (10/04/2026, 04:04:07 UTC)
Source: GCVE Database
Product: poetry

Description

Dulwich's stash pop function in version 1.2.7 is vulnerable to a symlink directory traversal that allows an attacker to write arbitrary files outside the repository worktree. This occurs because the function uses os.path.exists() which follows symlinks, enabling writes through malicious intermediate symlinks. An attacker can craft a repository that, when a victim pops a stash, writes attacker-controlled files such as .git/hooks/post-checkout, leading to remote code execution on the victim's machine during subsequent git operations. A patch is available to mitigate this issue by verifying symlink resolution before writing files.

CVSS v3.1

Score 8.6high

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

Affected software

Homebrewmore threats →ghsa
poetry
pkg:brew/poetry
Affected versions
>=2.0.0 <2.4.2

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

AILast updated: 10/04/2026, 12:28:23 UTC

Technical Analysis

The vulnerability exists in Dulwich's stash.py pop() function where it checks for parent directory existence using os.path.exists(), which follows symlinks. This allows an attacker to create a malicious repository with intermediate symlinks pointing outside the worktree. When a victim performs stash pop, files can be written outside the repository, such as to .git/hooks/post-checkout, enabling remote code execution. The validate_path() function does not detect symlinks, and build_file_from_blob() lacks symlink protection. The suggested fix involves verifying that no path component resolves outside the repository root using os.path.realpath() or using os.open() with O_NOFOLLOW.

Potential Impact

An attacker can cause arbitrary file writes outside the repository worktree on a victim's machine by exploiting symlink traversal during stash pop operations. This can lead to remote code execution by writing malicious git hook scripts, such as .git/hooks/post-checkout, which execute on subsequent git checkouts. The vulnerability affects confidentiality, integrity, and availability of the victim's system.

Mitigation Recommendations

A patch is available for this vulnerability. Users should upgrade to a fixed version of Dulwich that includes checks to ensure no path component resolves through symlinks outside the repository root before writing files. The fix involves validating paths using os.path.realpath() or opening files with O_NOFOLLOW to prevent symlink traversal. Until patched, avoid popping stashes from untrusted repositories.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
BREW-poetry-GHSA-cm62-gvxx-vmxx
Osv Schema Version
1.7.3
Ecosystems
["Homebrew"]
Cvss Version
3.1

Threat ID: 6ac2457d12601ec6a316405c

Added to database: 10/04/2026, 12:24:29 UTC

Last enriched: 10/04/2026, 12:28:23 UTC

Last updated: 10/04/2026, 12:28:23 UTC

Views: 2

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses