Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. dulwich
  4. ›
  5. CVE-2026-47712

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

June 8, 2026 (updated June 11, 2026)

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. Reduced examples:

  • x/../../x produced /0001-x/../../x.patch, resolving two directories above outdir.
  • x....\x produced the equivalent escape on Windows, here \ is also a path separator.

Related issues from the same root cause:

  • Subjects containing characters that are illegal in Windows filenames (e.g. :) caused format_patch to fail outright on Windows, where git would have succeeded.
  • Very long subjects produced excessively long filenames that could exceed filesystem limits; git truncates them.

Anyone 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.

References

  • github.com/advisories/GHSA-555p-6grf-mh7f
  • github.com/jelmer/dulwich/commit/c2446e51b
  • github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5
  • github.com/jelmer/dulwich/security/advisories/GHSA-555p-6grf-mh7f
  • nvd.nist.gov/vuln/detail/CVE-2026-47712

Code Behaviors & Features

Detect and mitigate CVE-2026-47712 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.24.0 before 1.2.5

Fixed versions

  • 1.2.5

Solution

Upgrade to version 1.2.5 or above.

Impact 3.3 LOW

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Source file

pypi/dulwich/CVE-2026-47712.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:22:36 +0000.