CVE-2026-47712Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`
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.
What to do
Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.
Debian, Red Hat, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | dulwich | Fix pending | UBUNTU-CVE-2026-47712 | |
| Ubuntu 26.04 | dulwich | Under investigation | UBUNTU-CVE-2026-47712 | |
| Ubuntu 25.10 | dulwich | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2026-47712 | |
| Ubuntu 24.04 | dulwich | Under investigation | UBUNTU-CVE-2026-47712 | |
| Ubuntu 22.04 | dulwich | Under investigation | UBUNTU-CVE-2026-47712 | |
| Ubuntu 20.04 | dulwich | Fix pending | UBUNTU-CVE-2026-47712 | |
| Ubuntu 18.04 | dulwich | Fix pending | UBUNTU-CVE-2026-47712 | |
| Ubuntu 16.04 | dulwich | Fix pending | UBUNTU-CVE-2026-47712 | |
| Debian 14 | dulwich | Fixed | 1.2.5-1 | DEBIAN-CVE-2026-47712 |
| Debian 13 | dulwich | Fix pending | DEBIAN-CVE-2026-47712 | |
| Debian 12 | dulwich | Fix pending | DEBIAN-CVE-2026-47712 | |
| Red Hat Enterprise Linux 8 | resource-agents | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | resource-agents-aliyun | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | resource-agents-gcp | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | resource-agents-paf | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents-aliyun | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents-gcp | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents-sap | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents-sap-hana | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | resource-agents-sap-hana-scaleout | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | sap-cluster-connector | Fix pending Fix deferred | ||
| PyPI library | dulwich | Fixed | 1.2.5 | PYSEC-2026-2462 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- jelmer dulwich: affected: >= 0.24.0, < 1.2.5
References
- https://github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f
- https://github.com/jelmer/dulwich/commit/c2446e51b
- https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.