CVE-2026-122299: Dulwich before 1.2.20 Commit Parser Tree Header Misinterpretation
Dulwich before 1.2.20 contains a commit object parsing vulnerability where the read path in parsecommit resolves a duplicate tree header to the last occurrence instead of the first, diverging from core git's resolution behavior, while Poetry 2.5.1 ships this version and uses dulwich by default for git dependency installation. Attackers can craft a commit object with two tree headers so that reviewers and CI using git see a benign tree while Poetry's dulwich-based checkout resolves to a different attacker-controlled tree containing malicious build scripts such as setup.py, resulting in unreviewed code execution on the install or build host.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
dulwichto a version that resolves this vulnerability.Fixed in 1.2.20
Event History
Frequently Asked Questions
Who is exposed to this issue?
Install or build hosts are exposed when Poetry 2.5.1 uses its bundled Dulwich version to install a Git dependency. The risk is especially relevant where dependency commits are reviewed or validated with core Git, because core Git and the affected Dulwich parser can resolve the same crafted commit to different trees.
What does an attacker need to exploit it?
An attacker needs to provide a crafted commit object containing two tree headers and have the target install or build process consume it through the affected Dulwich-based checkout path. The resulting tree can contain malicious build scripts, such as setup.py, that execute during installation or build.
Is user interaction required?
Yes. The supplied vector identifies user interaction as required, and the described impact occurs when the crafted Git dependency is installed or built by the target environment.
What version should be used to remediate the Dulwich parser issue?
Upgrade Dulwich to version 1.2.20 or later. The issue affects versions before 1.2.20.