<?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/"><channel><title>Gitoxide — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gitoxide/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Mon, 29 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gitoxide/feed.xml" rel="self" type="application/rss+xml"/><item><title>gix and gitoxide Submodule Path Traversal Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-29-git-submodule-path-traversal/</link><pubDate>Mon, 29 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-29-git-submodule-path-traversal/</guid><description>A path traversal vulnerability exists in gix and gitoxide where unvalidated submodule names from `.gitmodules` can be used to escape the `.git/modules` directory, potentially leading to repository confusion by redirecting submodule state inspection and open operations to attacker-controlled paths.</description><content:encoded><![CDATA[<p>A path traversal vulnerability has been identified in the gix and gitoxide libraries. The vulnerability stems from the lack of validation of submodule names extracted from the <code>.gitmodules</code> file. Specifically, these submodule names are used to construct file paths for accessing submodule Git directories. An attacker can craft a malicious <code>.gitmodules</code> file containing a submodule name with path traversal sequences (e.g., <code>../../../escaped-target.git</code>). This allows the attacker to redirect <code>state()</code> and <code>open()</code> calls to an arbitrary repository outside the intended <code>.git/modules</code> directory. This can cause a vulnerable application using these libraries to operate on an unexpected repository, leading to potential security issues. The vulnerability affects gix versions prior to 0.83.0 and gitoxide versions up to and including 0.52.0.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious <code>.gitmodules</code> file.</li>
<li>The malicious <code>.gitmodules</code> file contains a submodule name with path traversal sequences (e.g., <code>../../../escaped-target.git</code>).</li>
<li>A vulnerable application using gix or gitoxide parses the malicious <code>.gitmodules</code> file.</li>
<li>The application extracts the unvalidated submodule name from the <code>.gitmodules</code> file.</li>
<li>The application constructs a file path to the submodule&rsquo;s Git directory using the unvalidated name: <code>&lt;superproject common_dir&gt;/modules/&lt;submodule name&gt;</code>.</li>
<li>Due to the path traversal sequences in the submodule name, the constructed path escapes the intended <code>.git/modules</code> directory.</li>
<li>The application calls <code>state()</code> or <code>open()</code> using the escaped path, which leads to an attacker-controlled repository.</li>
<li>The application performs operations (enumeration, inspection, etc.) on the attacker-chosen repository, potentially leading to information disclosure or other unexpected behavior.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The vulnerability can lead to repository confusion, where a vulnerable application operates on an unintended repository. While the report does not claim direct command execution, the redirection of repository access can have significant consequences. For example, if the application relies on submodule state for access control or other security-sensitive operations, an attacker could potentially bypass these checks by redirecting the application to a controlled repository. The number of victims and sectors affected depend on the adoption of the vulnerable gix and gitoxide libraries.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to gix version 0.83.0 or later to patch the vulnerability.</li>
<li>Upgrade to a version of gitoxide later than 0.52.0, if available (or switch to gix).</li>
<li>Deploy the Sigma rule <code>Detect Git Submodule Path Traversal in Configuration</code> to identify potentially malicious <code>.gitmodules</code> files based on submodule name patterns.</li>
<li>Sanitize or validate submodule names before using them to construct file paths, as recommended in the advisory.</li>
<li>Monitor application logs for suspicious activity related to submodule operations, especially those involving unusual file paths.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>git</category><category>repository-confusion</category><category>supply-chain</category></item></channel></rss>