<?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>Gix-Validate (Vulnerable: &lt;= 0.10.0) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gix-validate-vulnerable--0.10.0/</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>Wed, 03 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gix-validate-vulnerable--0.10.0/feed.xml" rel="self" type="application/rss+xml"/><item><title>gix Submodule Path Traversal and Credential Disclosure</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-gix-submodule-traversal/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-gix-submodule-traversal/</guid><description>A vulnerability in gix's submodule name validation allows path traversal via a crafted .gitmodules file, combined with a trust inheritance flaw in Submodule::open(), enabling arbitrary git repository config reading, including credentials, with full trust.</description><content:encoded><![CDATA[<p>A path traversal vulnerability exists within the gix library, specifically affecting applications that utilize git submodules. This flaw stems from inadequate validation of submodule names, allowing an attacker to craft a malicious <code>.gitmodules</code> file containing directory traversal sequences (e.g., <code>../</code>). The vulnerability is amplified by a trust inheritance issue where submodule repositories inherit the <code>git_dir_trust</code> setting from their parent, bypassing ownership checks. Successful exploitation allows an attacker to read sensitive configuration files, potentially including credentials, from arbitrary git directories. This vulnerability affects gix versions prior to 0.83.0 and gix-validate versions 0.10.0 and earlier.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious git repository with a specially crafted <code>.gitmodules</code> file containing path traversal sequences in the submodule name (e.g., <code>x..y/../../..</code>).</li>
<li>A victim clones the attacker&rsquo;s repository using a tool built on the vulnerable gitoxide library (gix).</li>
<li>The victim&rsquo;s tool iterates through the submodules, potentially triggered by commands like <code>submodule.open()</code> or <code>submodule.status()</code>.</li>
<li>The <code>git_dir()</code> function, due to insufficient validation, constructs a path that traverses outside the intended submodule directory (e.g., resolving to the parent <code>.git/</code> directory).</li>
<li>The <code>open_opts()</code> function is called with <code>Trust::Full</code> inherited from the parent repository, skipping ownership checks.</li>
<li>The library opens the traversed path (e.g., the parent&rsquo;s <code>.git/config</code> file) as a trusted repository.</li>
<li>The attacker can then access sensitive configuration values, such as <code>remote.origin.url</code>, <code>http.extraHeader</code> (containing tokens), <code>credential.*</code> sections, and <code>core.sshCommand</code>.</li>
<li>The attacker extracts the exposed credentials via standard API calls, such as <code>repo.config_snapshot().string(&quot;http.extraHeader&quot;)</code>.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability enables an attacker to read sensitive configuration files from arbitrary git repositories accessible to the vulnerable application. This includes potential disclosure of credentials such as tokens embedded in URLs or HTTP headers, SSH keys, and other sensitive information. The impact is high due to the potential for lateral movement and further compromise within the victim&rsquo;s environment. This is similar to GHSA-7w47-3wg8-547c.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the suggested fix by patching the gix and gix-validate libraries to version 0.83.0 or later to resolve the validation bypass and trust inheritance issues.</li>
<li>Implement a detection rule for process creation events where a git command is executed with a submodule path containing directory traversal sequences (<code>..</code>) based on the flawed validation in <code>gix-validate/src/submodule.rs</code> as described in the overview.</li>
<li>Deploy the Sigma rule &ldquo;Detect Git Submodule Path Traversal&rdquo; to identify potential exploitation attempts (see rules section below).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>credential-disclosure</category><category>git</category></item></channel></rss>