CVEfocus › CVE database › CVE-2026-47712

CVE-2026-47712Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`

CVSS 3.3 LowEPSS 0.2% (higher than 4% of CVEs)Published 2026-06-10Updated 2026-06-11Assigner: GitHub_M

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.

CWE-22

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

2Fixed
17Fix pending
3Under investigation
1Will not fix

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10dulwichFix pendingUBUNTU-CVE-2026-47712
Ubuntu 26.04dulwichUnder investigationUBUNTU-CVE-2026-47712
Ubuntu 25.10dulwichWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2026-47712
Ubuntu 24.04dulwichUnder investigationUBUNTU-CVE-2026-47712
Ubuntu 22.04dulwichUnder investigationUBUNTU-CVE-2026-47712
Ubuntu 20.04dulwichFix pendingUBUNTU-CVE-2026-47712
Ubuntu 18.04dulwichFix pendingUBUNTU-CVE-2026-47712
Ubuntu 16.04dulwichFix pendingUBUNTU-CVE-2026-47712
Debian 14dulwichFixed1.2.5-1DEBIAN-CVE-2026-47712
Debian 13dulwichFix pendingDEBIAN-CVE-2026-47712
Debian 12dulwichFix pendingDEBIAN-CVE-2026-47712
Red Hat Enterprise Linux 8resource-agentsFix pending
Fix deferred
Red Hat Enterprise Linux 8resource-agents-aliyunFix pending
Fix deferred
Red Hat Enterprise Linux 8resource-agents-gcpFix pending
Fix deferred
Red Hat Enterprise Linux 8resource-agents-pafFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agentsFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agents-aliyunFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agents-gcpFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agents-sapFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agents-sap-hanaFix pending
Fix deferred
Red Hat Enterprise Linux 7resource-agents-sap-hana-scaleoutFix pending
Fix deferred
Red Hat Enterprise Linux 7sap-cluster-connectorFix pending
Fix deferred
PyPI librarydulwichFixed1.2.5PYSEC-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.

References

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.