/

CVE-2026-114098

Severity:

HIGH RISK

(7.8)

Path Traversal (CWE-22) in Dulwich stash.py pop() Logic

CVE-2026-114098

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and Potential Code Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in Dulwich allows a malicious repository's stashed changes to write files outside the intended worktree through intermediate directory symlinks. If an attacker can cause the repository's stash to be popped, the written content may modify Git hook locations and enable code execution during a later checkout.

A path traversal vulnerability in Dulwich allows a malicious repository's stashed changes to write files outside the intended worktree through intermediate directory symlinks. If an attacker can cause the repository's stash to be popped, the written content may modify Git hook locations and enable code execution during a later checkout.

Affected context

The vulnerability occurs in Dulwich's stash handling when stash.py processes a popped stash. It becomes risky when a repository contains attacker-controlled paths or intermediate symlinks and the stash operation does not sufficiently constrain resolved destinations to the worktree. The affected behavior is associated with Dulwich releases from 0.22.5 through versions before 1.2.8.

The vulnerability occurs in Dulwich's stash handling when stash.py processes a popped stash. It becomes risky when a repository contains attacker-controlled paths or intermediate symlinks and the stash operation does not sufficiently constrain resolved destinations to the worktree. The affected behavior is associated with Dulwich releases from 0.22.5 through versions before 1.2.8.

Exploit preconditions

  • Attack surface: Repository and stash-processing functionality in Dulwich
  • Required access: Ability to provide or induce processing of a malicious repository and its stash
  • Trigger point: Execution of the stash pop() operation
  • Why exploitation is possible: Intermediate directory symlinks can redirect file writes outside the intended worktree, allowing attacker-controlled content to reach sensitive repository paths
  • Attack surface: Repository and stash-processing functionality in Dulwich
  • Required access: Ability to provide or induce processing of a malicious repository and its stash
  • Trigger point: Execution of the stash pop() operation
  • Why exploitation is possible: Intermediate directory symlinks can redirect file writes outside the intended worktree, allowing attacker-controlled content to reach sensitive repository paths

Why this happens

The underlying bug is insufficient containment of file paths during stash restoration. Path components are processed without reliably preventing symlink-mediated resolution outside the intended worktree, allowing a crafted repository to redirect writes to arbitrary filesystem locations. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

The underlying bug is insufficient containment of file paths during stash restoration. Path components are processed without reliably preventing symlink-mediated resolution outside the intended worktree, allowing a crafted repository to redirect writes to arbitrary filesystem locations. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An attacker may write arbitrary files accessible to the Dulwich process.
  • Repository metadata or Git hook files could be modified.
  • Code could execute when a modified hook is triggered by a later checkout.
  • Local credentials, source code, or other files could be altered or damaged.
  • A compromised developer or automation environment could facilitate further attacks.
  • An attacker may write arbitrary files accessible to the Dulwich process.
  • Repository metadata or Git hook files could be modified.
  • Code could execute when a modified hook is triggered by a later checkout.
  • Local credentials, source code, or other files could be altered or damaged.
  • A compromised developer or automation environment could facilitate further attacks.

General mitigation guidance

Mitigation typically focuses on enforcing destination confinement during all repository file operations.

Common defensive patterns include:

  • Canonicalizing and validating resolved paths before writing files.
  • Rejecting symlinked parent directories when restoring worktree content.
  • Ensuring every destination remains beneath the intended worktree after filesystem resolution.
  • Using secure file-creation and extraction APIs that do not follow unsafe links.
  • Processing repositories with least-privilege accounts and restricted filesystem access.
  • Treating externally supplied repositories and stashes as untrusted input.
  • Applying repository policy controls that limit executable hooks in automated environments.

Mitigation typically focuses on enforcing destination confinement during all repository file operations.

Common defensive patterns include:

  • Canonicalizing and validating resolved paths before writing files.
  • Rejecting symlinked parent directories when restoring worktree content.
  • Ensuring every destination remains beneath the intended worktree after filesystem resolution.
  • Using secure file-creation and extraction APIs that do not follow unsafe links.
  • Processing repositories with least-privilege accounts and restricted filesystem access.
  • Treating externally supplied repositories and stashes as untrusted input.
  • Applying repository policy controls that limit executable hooks in automated environments.

How teams detect issues like this

Organizations commonly detect this class of issue through:

  • Static analysis for path joins, archive extraction, and file writes that lack canonical containment checks.
  • Code review searches for filesystem operations that follow symlinks during repository or stash restoration.
  • Tests using symlinked parent directories to verify that writes cannot escape the designated worktree.
  • Runtime monitoring for unexpected writes to .git/hooks or other files outside repository boundaries.
  • Policy enforcement that restricts hook execution and filesystem permissions in CI or automation.

Automated security review tools may help identify unsafe path handling patterns, but filesystem-behavior tests remain important.

Organizations commonly detect this class of issue through:

  • Static analysis for path joins, archive extraction, and file writes that lack canonical containment checks.
  • Code review searches for filesystem operations that follow symlinks during repository or stash restoration.
  • Tests using symlinked parent directories to verify that writes cannot escape the designated worktree.
  • Runtime monitoring for unexpected writes to .git/hooks or other files outside repository boundaries.
  • Policy enforcement that restricts hook execution and filesystem permissions in CI or automation.

Automated security review tools may help identify unsafe path handling patterns, but filesystem-behavior tests remain important.

Sources

SourceLink
github.comgithub.com/jelmer/dulwich/security/advisories/GHSA-cm62-gvxx-vmxx
vulncheck.comvulncheck.com/advisories/dulwich-0.22.5-before-1.2.8-path-traversal-via-stash-pop-symlinks

Frequently asked

questions

It is generally not a standalone network-service vulnerability. Exploitation may occur when an application, developer tool, or automation system processes a malicious repository and performs the affected stash operation.

The attacker typically needs a way to supply or influence a repository containing crafted stash and filesystem entries. Direct access to the victim's machine is not necessarily required if an automated workflow processes untrusted repositories.

Constrain every restored path to the intended worktree after resolving symlinks and reject destinations that escape that boundary. Secure file-creation behavior should also prevent unsafe link traversal.

Treat repositories as untrusted input, test path-handling code with symlink and traversal cases, run automation with minimal privileges, and restrict execution of repository-controlled hooks.

It is generally not a standalone network-service vulnerability. Exploitation may occur when an application, developer tool, or automation system processes a malicious repository and performs the affected stash operation.

The attacker typically needs a way to supply or influence a repository containing crafted stash and filesystem entries. Direct access to the victim's machine is not necessarily required if an automated workflow processes untrusted repositories.

Constrain every restored path to the intended worktree after resolving symlinks and reject destinations that escape that boundary. Secure file-creation behavior should also prevent unsafe link traversal.

Treat repositories as untrusted input, test path-handling code with symlink and traversal cases, run automation with minimal privileges, and restrict execution of repository-controlled hooks.

Find out what's already
exploitable in your codebase.