CVE-2026-47712 Details
Description
Dulwich is a pure-Python implementation of the Git file formats and protocols. Starting in version 0.24.0 and prior to version 1.2.5, 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. This is fixed in Dulwich 1.2.5. Users should upgrade to 1.2.5 or later. 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. 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; and/or 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.
A path traversal vulnerability has been identified in Dulwich, a pure-Python implementation of Git file formats and protocols. This issue affects versions 0.24.0 prior to 1.2.5. The vulnerability arises in the `porcelain.format_patch` function, where patch filenames are derived from the commit's subject line. The `get_summary` function, responsible for this transformation, only replaced spaces with dashes, leaving path separators, parent-directory components, and other filename-hostile characters intact. As a result, a malicious commit subject could manipulate the patch file's location, directing it outside the specified output directory. This issue has been addressed in Dulwich version 1.2.5, which sanitizes commit subjects to prevent such exploits.
Users are advised to upgrade to Dulwich version 1.2.5 or later. For those unable to upgrade immediately, it is recommended to validate the patch file's destination before opening it, ensuring it remains within the intended output directory.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
Volerion
Assessed Jun 10, 2026CISA-ADP
Assessed Jun 11, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/jelmer/dulwich/commit/c2446e51b | [email protected] | Source CodeVendor |
| https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5 | [email protected] | Release NotesVendor |
| https://github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f | [email protected] | AdvisoryBundleRemedyVendor |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| Dulwich | >= 0.24.0, < 1.2.5 (semver) |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jul 21, 2026 | CVE Translated | [email protected] |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 10, 2026 | New CVE Received | [email protected] |
Volerion