Skip to main content

Dulwich CVE-2026-47712

LOW
Path Traversal (CWE-22)
2026-06-08 https://github.com/jelmer/dulwich GHSA-555p-6grf-mh7f
3.3
CVSS 3.1 · Vendor: https://github.com/jelmer/dulwich
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft commit with traversal subject (e.g., x/../../target)
  2. Delivery
    Submit commit to service processing untrusted repos
  3. Exploit
    Service calls format_patch(outdir=...) on malicious commit
  4. Execution
    get_summary returns unsanitized path component
  5. Persist
    os.path.join resolves traversal outside outdir
  6. Impact
    Patch file written to attacker-chosen filesystem path

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires two concurrent conditions: (1) the application calls dulwich.porcelain.format_patch with a non-None outdir parameter, and (2) the commits passed to that call originate from an untrusted source such as a user-submitted repository, pull request, or remote fetch. Applications that exclusively format patches from trusted internal repositories are not at risk. The CVSS UI:R reflects that the service operator or automated pipeline must actively invoke format_patch on attacker-controlled data. Impact is constrained to file write operations within the process's filesystem permissions (CVSS C:N, A:N) - no data is read or exfiltrated, and no code execution is implied by this vulnerability alone. Dulwich versions prior to 0.24.0 are not listed as affected per the advisory's version range data. The 'Microsoft' tag in the intelligence data corresponds to the Windows-specific backslash path separator variant described in the advisory.

Impact

CVSS 3.3 with vector AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N reflects a constrained impact profile: local attack vector, no privileges required, but user interaction required (the service operator or automated pipeline must invoke format_patch on attacker-controlled input), with impact limited to integrity (write-only, no confidentiality breach, no availability impact). The AV:L designation warrants clarification - the 'local' vector here models the scenario where an attacker provides input data (the repository) rather than direct network access to the service, which understates real-world risk for services that fetch and process remote repositories. No KEV listing and no EPSS score were provided in the input data; exploitation status is no public exploit identified at time of analysis. Real-world priority is highly deployment-dependent: applications that never pass untrusted commit data to format_patch(outdir=...) have zero exposure, while public-facing services processing user-supplied repositories face a genuine file write primitive limited only by the process's filesystem permissions.

Exploit ScenarioDerived

An attacker submits a pull request or pushes a commit to a repository processed by a Dulwich-based service, setting the commit subject to 'x/../../etc/cron.d/payload' (or a Windows equivalent with backslashes). When the service calls porcelain.format_patch(outdir='/tmp/patches') against that commit, get_summary returns the unsanitized subject, os.path.join resolves the traversal, and the patch file is written to '/etc/cron.d/payload.patch' - outside the intended output directory - subject to the process's write permissions. No special tooling or prior authentication to the target service is needed beyond the ability to submit commits.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 08, 2026

Path traversal in Dulwich's porcelain.format_patch function allows patch files to be written outside the intended output directory by processing commits with malicious subject lines. Any service passing untrusted commits to dulwich.porcelain.format_patch(outdir=...) - such as CI pipelines, PR review platforms, or developer tooling processing third-party repositories - is affected in versions 0.24.0 through 1.2.4. No public exploit identified at time of analysis and no CISA KEV listing, but the attack pattern is trivially reproducible from the advisory description alone; exploitation requires no special tooling beyond crafting a commit with a subject like 'x/../../target'.

RemediationAI

Vendor-released patch: Dulwich 1.2.5. Upgrade immediately via 'pip install dulwich>=1.2.5'. The fix commit is https://github.com/jelmer/dulwich/commit/c2446e51b and the advisory is at https://github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f. If upgrading is not immediately possible, three targeted workarounds exist with different trade-offs. First, pass stdout=True to format_patch and handle file naming yourself - this eliminates the vulnerable filename derivation path entirely but requires callers to manage output file creation. Second, validate each returned path after the call using os.path.realpath(returned_path) vs. os.path.realpath(outdir) and reject any path not inside outdir - this is a safe catch-all but adds post-call I/O overhead and does not prevent the file from being momentarily created at the wrong location before rejection. Third, pre-screen commit subjects before calling format_patch and reject any subject containing '/', '\', '..', or other filesystem-hostile characters - effective but requires platform-aware validation logic and may miss edge cases on Windows where '\' is a path separator.

Affected Packages

pypi dulwich fix: 1.2.5

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Dulwich is a pure-Python implementation of Git file formats and protocols, distributed as the pip package 'dulwich' (CPE: pkg:pip/dulwich). The root cause is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) in dulwich/patch.py's get_summary() function. Prior to the fix, get_summary() only substituted spaces with dashes before embedding the commit subject directly into os.path.join(outdir, f'{i:04d}-{summary}.patch'). This meant path separators ('/', '\'), parent-directory components ('..'), and Windows-illegal characters (e.g., ':') were passed verbatim. On POSIX systems, a subject like 'x/../../x' resolves two directories above outdir; on Windows, backslash variants achieve the same. The fix introduces _sanitize_subject_for_filename(), which mirrors git's format_sanitized_subject in pretty.c - retaining only [A-Za-z0-9._], collapsing runs of other characters to '-', collapsing consecutive dots, enforcing a length cap of 52 characters, and stripping trailing '.' and '-'.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/jelmer/dulwich) PRIMARY 3.3 LOW
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N

Primary rating from Vendor (https://github.com/jelmer/dulwich) · only source for this CVE.

CVSS VectorVendor: https://github.com/jelmer/dulwich

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

DescriptionCVE.org

Impact

dulwich.porcelain.format_patch(outdir=...) derives each patch filename from the commit's subject line. Prior to this fix, get_summary only replaced spaces with dashes - path separators (/, \), parent-directory components (..), and other filename-hostile characters (e.g. :) were preserved verbatim and passed straight into os.path.join(outdir, f"{i:04d}-{summary}.patch").

A malicious commit subject could therefore direct the generated patch file outside the requested outdir. Reduced examples:

  • x/../../x produced <outdir>/0001-x/../../x.patch, resolving

two directories above outdir.

  • x\..\..\x produced the equivalent escape on Windows, here \ is also a path separator.

Related issues from the same root cause:

  • Subjects containing characters that are illegal in Windows filenames (e.g. :) caused format_patch to fail outright on Windows, where git would have succeeded.
  • Very long subjects produced excessively long filenames that could exceed filesystem limits; git truncates them.

Anyone calling porcelain.format_patch (or the dulwich format-patch CLI) against untrusted commits - for example, a service that runs format-patch over user-supplied repositories or pull requests - could have patch files written to attacker-chosen locations within the process's write permissions.

Patches

Fixed in Dulwich 1.2.5. Users should upgrade.

dulwich.patch.get_summary now mirrors git's format_sanitized_subject: only [A-Za-z0-9._] are kept, runs of other characters collapse to a single -, consecutive . collapse to a single ., trailing ./- are stripped, and the result is length-limited. This makes the returned string safe to embed as a filename component, so format_patch can no longer be steered out of outdir via the commit subject.

Workarounds

Until upgrading, callers that pass untrusted commits to porcelain.format_patch can:

  • Use stdout=True and write the patch to a destination they control, rather than letting format_patch choose the filename.
  • Validate the chosen path before opening - e.g. compare os.path.realpath(returned_path) against os.path.realpath(outdir) and reject any patch whose resolved path is not inside outdir.
  • Pre-screen commits and refuse to format any whose subject's first line contains /, \, .., or other characters that are not safe on the target filesystem.

Resources

  • Fix commit: https://github.com/jelmer/dulwich/commit/c2446e51b
  • Affected API: dulwich.porcelain.format_patch / dulwich format-patch
  • Reference behavior: git's format_sanitized_subject in pretty.c

Threat Intelligence Overview

EPSS Score
0.0%
Top 99% exploitable
Threat Intel
1
1 sources
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Low
Technical Impact
Partial

Priority Score

16
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +16
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:pip/dulwich

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy