{"id":"CVE-2026-47712","aliases":["CLSA-2026-1784164011","DEBIAN-CVE-2026-47712","EUVD-2026-36186","GHSA-555p-6grf-mh7f","PYSEC-2026-2462","UBUNTU-CVE-2026-47712","openSUSE-SU-2026:10900-1"],"status":"published","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 (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.","severity":{"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","level":"low","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00139,"percentile":0.03255,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-22"],"published":"2026-05-29T00:00:00Z","modified":"2026-10-28T02:31:14Z","fixes":[{"ecosystem":"PyPI","package":"dulwich","fixed_in":["1.2.5"],"sources":["ghsa","osv"]},{"ecosystem":"TuxCare:PyPI","package":"dulwich","fixed_in":["0.25.2.post6+tuxcare"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"dulwich","fixed_in":["1.2.5-1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"PyPI","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.24.0"},{"fixed":"1.2.5"}]}]},{"source":"osv","ecosystem":"TuxCare:PyPI","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.25.2"},{"fixed":"0.25.2.post6+tuxcare"}]}],"versions":["0.25.2","0.25.2.post1+tuxcare","0.25.2.post2+tuxcare","0.25.2.post3+tuxcare","0.25.2.post4+tuxcare","0.25.2.post5+tuxcare"]},{"source":"osv","ecosystem":"Debian:12","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.21.2-1","0.21.5-1","0.21.6-1","0.22.5-1","0.22.7-1","0.22.7-2","0.24.10-1","0.24.2-1","0.24.2-2","1.0.0-1","1.0.0-2","1.1.0-1","1.1.0-2","1.1.0-3","1.2.0-1","1.2.1-1","1.2.11-1","1.2.12-1","1.2.5-1","1.2.7-1","1.2.7-2"]},{"source":"osv","ecosystem":"Debian:13","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.22.7-1","0.22.7-2","0.24.10-1","0.24.2-1","0.24.2-2","1.0.0-1","1.0.0-2","1.1.0-1","1.1.0-2","1.1.0-3","1.2.0-1","1.2.1-1","1.2.11-1","1.2.12-1","1.2.5-1","1.2.7-1","1.2.7-2"]},{"source":"osv","ecosystem":"Debian:14","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.2.5-1"}]}],"versions":["0.22.7-1","0.22.7-2","0.24.10-1","0.24.2-1","0.24.2-2","1.0.0-1","1.0.0-2","1.1.0-1","1.1.0-2","1.1.0-3","1.2.0-1","1.2.1-1"]},{"source":"osv","ecosystem":"PyPI","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.24.0"},{"fixed":"1.2.5"}]}],"versions":["0.24.0","0.24.1","0.24.10","0.24.2","0.24.3","0.24.4","0.24.5","0.24.6","0.24.7","0.24.8","0.24.9","0.25.0","0.25.1","0.25.2","1.0.0","1.1.0","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4"]},{"source":"osv","ecosystem":"PyPI","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.24.0"},{"fixed":"1.2.5"}]}],"versions":["0.24.0","0.24.1","0.24.10","0.24.2","0.24.3","0.24.4","0.24.5","0.24.6","0.24.7","0.24.8","0.24.9","0.25.0","0.25.1","0.25.2","1.0.0","1.1.0","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4"]},{"source":"osv","ecosystem":"Ubuntu:16.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.11.2-1ubuntu1","0.12.0-1","0.12.0-1build1","0.12.0-1build2"]},{"source":"osv","ecosystem":"Ubuntu:18.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.18.2-1build1","0.18.5-1"]},{"source":"osv","ecosystem":"Ubuntu:20.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.19.11-2","0.19.14-4ubuntu1","0.19.15-1","0.19.15-1build1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.20.15-1ubuntu1","0.20.31-1ubuntu1","0.20.31-1.1","0.20.31-1.1build1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.21.6-1","0.21.6-1build1","0.21.6-1build2"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.22.7-1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.0-3","1.2.12-1"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.22.7-1","0.24.2-2","1.1.0-2ubuntu1","1.1.0-3"]},{"source":"osv","ecosystem":"openSUSE:Tumbleweed","package":"python-dulwich","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.2.5-1.1"}]}],"bundled":3}],"products":[{"vendor":"jelmer","product":"dulwich"}],"references":[{"url":"https://github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f","tags":["x_refsource_CONFIRM","advisory","web","report"]},{"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://nvd.nist.gov/vuln/detail/CVE-2026-47712","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-555p-6grf-mh7f","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/47xxx/CVE-2026-47712.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-47712","tags":["advisory"]},{"url":"https://github.com/jelmer/dulwich","tags":["package"]},{"url":"https://pypi.org/project/dulwich","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2026-47712","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-47712","tags":["report"]},{"url":"","tags":["advisory"]},{"url":"https://www.suse.com/security/cve/CVE-2026-42305","tags":["web"]},{"url":"https://www.suse.com/security/cve/CVE-2026-42563","tags":["web"]},{"url":"https://www.suse.com/security/cve/CVE-2026-47712","tags":["web"]}],"sources":{"cve":[{"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 (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.","status":"published","published":"2026-06-10T22:01:49.996Z","modified":"2026-06-11T12:42:40.209Z","cvss":[{"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","level":"low","assessor":"cna"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T13:36:40.478484Z"}],"euvd":[{"id":"EUVD-2026-36186","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.","status":"published","published":"2026-06-10T22:01:49Z","modified":"2026-06-11T12:42:40Z","cvss":[{"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","level":"low"}],"updated_at":"2026-11-02T18:20:44.570445Z"}],"ghsa":[{"id":"GHSA-555p-6grf-mh7f","title":"Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`","description":"### Impact\n\ndulwich.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\").\n\nA malicious commit subject could therefore direct the generated patch file outside the requested outdir. Reduced examples:\n\n- x/../../x produced \u003coutdir\u003e/0001-x/../../x.patch, resolving\n  two directories above outdir.\n- x\\..\\..\\x produced the equivalent escape on Windows, here \\ is also a path separator.\n\nRelated issues from the same root cause:\n\n- Subjects containing characters that are illegal in Windows filenames (e.g. :) caused format_patch to fail outright on  Windows, where git would have succeeded.\n- Very long subjects produced excessively long filenames that could exceed filesystem limits; git truncates them.\n\nAnyone calling porcelain.format_patch (or the dulwich format-patch CLI) against untrusted commits - for example, a service that runs format-patch over user-supplied repositories or pull requests - could have patch files written to attacker-chosen locations within the process's write permissions.\n\n### Patches\n\nFixed in Dulwich 1.2.5. Users should upgrade.\n\n 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.\n\n###  Workarounds\n\nUntil upgrading, callers that pass untrusted commits to   porcelain.format_patch can:\n\n- Use stdout=True and write the patch to a destination they control, rather than letting format_patch choose the filename.\n- 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.\n- 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.\n\n### Resources\n\n- Fix commit: https://github.com/jelmer/dulwich/commit/c2446e51b\n- Affected API: dulwich.porcelain.format_patch / dulwich format-patch\n- Reference behavior: git's format_sanitized_subject in pretty.c","status":"published","published":"2026-06-08T23:04:48Z","modified":"2026-06-11T14:07:17Z","cvss":[{"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","level":"low"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:40:26.12116Z"}],"nvd":[{"id":"CVE-2026-47712","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.","status":"published","published":"2026-06-10T23:16:48.65Z","modified":"2026-07-21T19:10:00.107Z","cvss":[{"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","level":"low","assessor":"secondary"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:12:23.485267Z"}],"osv":[{"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 (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.","status":"published","published":"2026-06-10T22:01:49.996Z","modified":"2026-10-28T02:31:14.987717816Z","cvss":[{"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","level":"low"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:45:06.231145Z"},{"id":"DEBIAN-CVE-2026-47712","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.","status":"published","published":"2026-06-10T23:16:48.65Z","modified":"2026-10-01T03:03:07.144798182Z","cvss":[{"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","level":"low"}],"updated_at":"2026-11-02T15:45:56.444225Z"},{"id":"GHSA-555p-6grf-mh7f","title":"Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`","description":"### Impact\n\ndulwich.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\").\n\nA malicious commit subject could therefore direct the generated patch file outside the requested outdir. Reduced examples:\n\n- x/../../x produced \u003coutdir\u003e/0001-x/../../x.patch, resolving\n  two directories above outdir.\n- x\\..\\..\\x produced the equivalent escape on Windows, here \\ is also a path separator.\n\nRelated issues from the same root cause:\n\n- Subjects containing characters that are illegal in Windows filenames (e.g. :) caused format_patch to fail outright on  Windows, where git would have succeeded.\n- Very long subjects produced excessively long filenames that could exceed filesystem limits; git truncates them.\n\nAnyone calling porcelain.format_patch (or the dulwich format-patch CLI) against untrusted commits - for example, a service that runs format-patch over user-supplied repositories or pull requests - could have patch files written to attacker-chosen locations within the process's write permissions.\n\n### Patches\n\nFixed in Dulwich 1.2.5. Users should upgrade.\n\n 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.\n\n###  Workarounds\n\nUntil upgrading, callers that pass untrusted commits to   porcelain.format_patch can:\n\n- Use stdout=True and write the patch to a destination they control, rather than letting format_patch choose the filename.\n- 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.\n- 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.\n\n### Resources\n\n- Fix commit: https://github.com/jelmer/dulwich/commit/c2446e51b\n- Affected API: dulwich.porcelain.format_patch / dulwich format-patch\n- Reference behavior: git's format_sanitized_subject in pretty.c","status":"published","published":"2026-06-08T23:04:48Z","modified":"2026-07-13T16:43:37.445090093Z","cvss":[{"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","level":"low"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:46:37.864461Z"},{"id":"PYSEC-2026-2462","title":"Dulwich doesn't sanitize commit subjects in `porcelain.format_patch`","description":"### Impact\n\ndulwich.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\").\n\nA malicious commit subject could therefore direct the generated patch file outside the requested outdir. Reduced examples:\n\n- x/../../x produced \u003coutdir\u003e/0001-x/../../x.patch, resolving\n  two directories above outdir.\n- x\\..\\..\\x produced the equivalent escape on Windows, here \\ is also a path separator.\n\nRelated issues from the same root cause:\n\n- Subjects containing characters that are illegal in Windows filenames (e.g. :) caused format_patch to fail outright on  Windows, where git would have succeeded.\n- Very long subjects produced excessively long filenames that could exceed filesystem limits; git truncates them.\n\nAnyone calling porcelain.format_patch (or the dulwich format-patch CLI) against untrusted commits - for example, a service that runs format-patch over user-supplied repositories or pull requests - could have patch files written to attacker-chosen locations within the process's write permissions.\n\n### Patches\n\nFixed in Dulwich 1.2.5. Users should upgrade.\n\n 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.\n\n###  Workarounds\n\nUntil upgrading, callers that pass untrusted commits to   porcelain.format_patch can:\n\n- Use stdout=True and write the patch to a destination they control, rather than letting format_patch choose the filename.\n- 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.\n- 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.\n\n### Resources\n\n- Fix commit: https://github.com/jelmer/dulwich/commit/c2446e51b\n- Affected API: dulwich.porcelain.format_patch / dulwich format-patch\n- Reference behavior: git's format_sanitized_subject in pretty.c","status":"published","published":"2026-07-13T15:46:15.56367Z","modified":"2026-07-13T16:31:45.177098535Z","cvss":[{"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","level":"low"}],"updated_at":"2026-11-02T15:52:55.961245Z"},{"id":"UBUNTU-CVE-2026-47712","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.","status":"published","published":"2026-06-10T23:16:00Z","modified":"2026-10-17T12:58:27.386289289Z","cvss":[{"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","level":"low"}],"updated_at":"2026-11-02T16:56:33.391918Z"},{"id":"CLSA-2026-1784164011","title":"TuxCare security update for dulwich (1 CVE)","description":"TuxCare rebuilt dulwich to address 1 CVE. Fixed in 0.25.2.post6+tuxcare.","status":"published","published":"2026-08-04T14:52:44Z","modified":"2026-10-15T09:48:05.129445873Z","updated_at":"2026-11-02T15:43:46.151924Z"},{"id":"openSUSE-SU-2026:10900-1","title":"python311-dulwich-1.2.5-1.1 on GA media","description":"These are all security issues fixed in the python311-dulwich-1.2.5-1.1 package on the GA media of openSUSE Tumbleweed.","status":"published","published":"2026-05-29T00:00:00Z","modified":"2026-05-30T23:15:07.9216998Z","updated_at":"2026-11-02T16:58:38.95195Z"}]}}
