Intel

AIKIDO-2026-82046

dulwich is vulnerable to Path Traversal

Path TraversalGHSA-cm62-gvxx-vmxx Published 4 days ago

86

High Risk

This Affects:

PYTHONdulwich
0.23.2 - 1.2.7
Fixed in 1.2.8
Are you affected? Scan for Free

TL;DR

The pop() function in dulwich/stash.py uses os.path.exists() to check for a parent directory before writing stashed files, and that check follows symlinks. When an intermediate directory in a stashed path is a symlink pointing outside the worktree, the subsequent file writes resolve through the link. An attacker who convinces a victim to pop a stash inside a malicious repository can write attacker-controlled content to arbitrary filesystem locations such as .git/hooks/post-checkout, achieving remote code execution on the next git operation. The fix verifies that no component of the target path resolves through a symlink outside the repository before writing.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you pop a stash in an untrusted repository.

Background info

dulwich is vulnerable to Path Traversal in versions 0.23.2 - 1.2.7.

How to fix this

Upgrade the dulwich library to the patch version.