{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2026-47712","id":"CVE-2026-47712","title":"Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`","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 (","descriptionLong":"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.","published":"2026-06-10T22:01:49.996Z","updated":"2026-10-28T02:31:14.987717816Z","reserved":"2026-05-19T21:29:25.481Z","status":"Deferred","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":3.3,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N","rating":"low","source":"GitHub_M"},"metrics":[{"version":"3.1","score":3.3,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N","rating":"low","source":"GitHub_M"},{"version":"3.1","score":3.3,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N","rating":"low","source":"github.com"},{"version":"3.1","score":3.3,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N","rating":"low","source":"OSV"},{"version":"3.1","score":3.3,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N","rating":"low","source":"GitHub"}],"rating":"low","products":["jelmer dulwich"],"affectedProducts":[{"vendor":"jelmer","product":"dulwich","defaultStatus":null,"versions":[{"version":">= 0.24.0, < 1.2.5","status":"affected"}],"platforms":[]}],"packages":[{"ecosystem":"PyPI","name":"dulwich","purl":"pkg:pypi/dulwich","ranges":[">=0.24.0 <1.2.5"],"fixed":["1.2.5"],"advisory":"GHSA-555p-6grf-mh7f"}],"cwes":["CWE-22"],"aliases":["GHSA-555p-6grf-mh7f","PYSEC-2026-2462"],"references":[{"url":"https://github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/jelmer/dulwich/commit/c2446e51b","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/47xxx/CVE-2026-47712.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47712","tags":["advisory"]},{"url":"https://github.com/jelmer/dulwich","tags":["package"]},{"url":"https://pypi.org/project/dulwich","tags":["package"]},{"url":"https://github.com/advisories/GHSA-555p-6grf-mh7f","tags":["advisory"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial"},"epss":0.00139,"epssPercentile":0.03328,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-47712","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47712","ok":true,"note":"Deferred"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2026-47712","ok":true,"note":"1 package"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-555p-6grf-mh7f","ok":true,"note":"GHSA-555p-6grf-mh7f"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-47712","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}