<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>Dulwich (0.22.5 - 1.2.7) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/dulwich-0.22.5---1.2.7/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 02 Oct 2026 20:23:31 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/dulwich-0.22.5---1.2.7/feed.xml" rel="self" type="application/rss+xml"/><image><url>https://feed.craftedsignal.io/favicon-32x32.png</url><title>CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/</link><width>32</width><height>32</height></image><webfeeds:icon>https://feed.craftedsignal.io/favicon.svg</webfeeds:icon><item><title>Arbitrary File Write in Dulwich via Symlink Directory Traversal</title><link>https://feed.craftedsignal.io/briefs/2026-10-dulwich-stash-traversal/</link><pubDate>Fri, 02 Oct 2026 20:23:31 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-10-dulwich-stash-traversal/</guid><description>The Dulwich library stash pop implementation fails to validate symlinks, allowing attackers to write arbitrary files outside the repository worktree and achieve remote code execution.</description><content:encoded><![CDATA[<p>The Dulwich library contains a path traversal vulnerability in its <code>stash.pop()</code> function, specifically within <code>dulwich/stash.py</code>. The vulnerability arises because the library uses <code>os.path.exists()</code> to verify directory paths before writing stashed files. Because <code>os.path.exists()</code> follows symlinks, it fails to detect when a target path resolves to a location outside the repository worktree. The <code>validate_path()</code> function provides insufficient validation as it only checks against forbidden filenames and does not account for symlink resolution. This flaw affects Dulwich versions 0.22.5 through 1.2.7. An attacker can weaponize this by creating a repository with carefully crafted symlinks that, when popped by a victim, overwrite sensitive system files or local configuration files.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker creates a malicious git repository containing a symlink (e.g., <code>link</code> pointing to <code>../../.git/hooks</code>).</li>
<li>Attacker creates a stash containing an executable payload file nested within that symlinked path (e.g., <code>link/post-checkout</code>).</li>
<li>Victim clones the malicious repository and checks out the branch containing the symlink.</li>
<li>Victim executes <code>stash.pop()</code> on the malicious stash content.</li>
<li>Dulwich evaluates the target path, where <code>os.path.exists()</code> confirms the presence of the directory via the symlink, bypassing safety checks.</li>
<li>The <code>build_file_from_blob()</code> function writes the payload content directly to the resolved location.</li>
<li>The payload is written to the victim's local <code>.git/hooks/post-checkout</code> file.</li>
<li>The victim triggers the payload upon the next git checkout, resulting in Remote Code Execution.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows for arbitrary file writes on the victim's system. By targeting critical hooks like <code>.git/hooks/post-checkout</code> within the local environment, an attacker can gain arbitrary command execution under the user context of the victim, leading to full compromise of the local development workstation.</p>
<h2 id="recommendation">Recommendation</h2>
<ol>
<li>Update the Dulwich library to a patched version once available.</li>
<li>Audit all automated tooling that utilizes Dulwich for git repository management to ensure they are running with the least privilege necessary.</li>
<li>Monitor local development directories for unexpected creation or modification of git hook files using File Integrity Monitoring (FIM).</li>
<li>For developers using the Dulwich library, implement path canonicalization using <code>os.path.realpath()</code> before file write operations to verify the target directory resides within the expected worktree.</li>
</ol>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>arbitrary-file-write</category><category>path-traversal</category><category>execution</category></item></channel></rss>