CVE-2026-47712 json
Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`
published 2026-06-08 5 mo ago modified 2026-07-21 3 mo ago also GHSA-555p-6grf-mh7f , PYSEC-2026-2462 , EUVD-2026-36186
- cvss
- 3.3
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.1%
- EPSS 0.1% chance of exploitation in 30 days, percentile 3%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi dulwich 1.2.5
- dulwich Debian 14 1.2.5-1
debian advisories DEBIAN-CVE-2026-47712
- python-dulwich openSUSE Tumbleweed 1.2.5-1.1
opensuse advisories openSUSE-SU-2026:10900-1
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2026-47712 updated cvss 3.3
dulwich: Dulwich: Arbitrary file write via malicious commit subject in format_patch
-
Red Hat Ansible Automation Platform 2 ansible-automation-platform-26/controller-rhel9, ansible-automation-platform-27/controller-rhel9, ansible-automation-platform-26/eda-controller-rhel9, ansible-automation-platform-27/eda-controller-rhel9, ansible-automation-platform-26/lightspeed-chatbot-rhel9 Red Hat Enterprise Linux 7 resource-agents, resource-agents-gcp, resource-agents-sap, sap-cluster-connector, resource-agents-aliyun, resource-agents-sap-hana, +1 more Red Hat Enterprise Linux 8 resource-agents, resource-agents-gcp, resource-agents-paf, resource-agents-aliyun Red Hat OpenShift AI (RHOAI) rhoai/odh-kserve-agent-rhel9, rhoai/odh-kserve-router-rhel9, rhoai/odh-kserve-controller-rhel9, rhoai/odh-kserve-autogluon-server-rhel9, rhoai/odh-kserve-storage-initializer-rhel9 Red Hat OpenShift Container Platform 4 python-dulwich Red Hat Satellite 6 python-dulwichaffected: workaround, no fix available “Fix deferred”
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 4 mo ago
Exploit prediction
0.14% chance of exploitation in the next 30 days, higher than 3% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 3.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N |
| GitHub | 3.1 | 3.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N |
| OSV | 3.1 | 3.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | dulwich | >=0.24.0, <1.2.5 |
1.2.5 |
Affected products
- jelmer dulwich
Classification
- Weakness
-
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory
References
-
github.com
/jelmer/dulwich/commit/c2446e51b
web
-
github.com
/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f
web
-
github.com
/jelmer/dulwich/releases/tag/dulwich-1.2.5
web
-
nvd.nist.gov
/vuln/detail/CVE-2026-47712
advisory
-
github.com
/jelmer/dulwich
package
-
pypi.org
/project/dulwich
package
-
github.com
/advisories/GHSA-555p-6grf-mh7f
advisory
Sources
- CVE List CVE-2026-47712
- GitHub Advisory GHSA-555p-6grf-mh7f
- NVD CVE-2026-47712
- OSV PYSEC-2026-2462
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.