<?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>GitPython (&lt;= 3.1.52) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gitpython--3.1.52/</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, 24 Jul 2026 16:33:29 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gitpython--3.1.52/feed.xml" rel="self" type="application/rss+xml"/><item><title>GitPython Arbitrary Config Injection via Submodule Name (GHSA-3rp5-jjmw-4wv2)</title><link>https://feed.craftedsignal.io/briefs/2026-07-gitpython-config-injection/</link><pubDate>Fri, 24 Jul 2026 16:33:29 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-gitpython-config-injection/</guid><description>A critical vulnerability in GitPython versions up to 3.1.52 allows attackers to inject arbitrary Git configuration directives into a victim's `.git/config` file by crafting a malicious submodule name, leading to remote code execution (RCE) during subsequent Git operations that trigger `core.sshCommand`.</description><content:encoded><![CDATA[<p>A high-severity vulnerability (GHSA-3rp5-jjmw-4wv2) exists in the GitPython library, affecting all versions up to and including 3.1.52. This flaw enables attackers to achieve remote code execution (RCE) on a victim's system. The vulnerability stems from insufficient neutralization of special characters (specifically <code>]</code>, <code>[</code>, and <code>&quot;</code>) in Git configuration section names. An attacker can craft a malicious submodule name, which, when processed by GitPython's config writer, leads to the injection of arbitrary configuration directives into the victim's <code>.git/config</code> file. This can be exploited through two primary vectors: an application using <code>Repo.create_submodule</code> with untrusted input, or by cloning an untrusted repository followed by <code>submodule_update</code>. Once injected, a directive like <code>core.sshCommand</code> can execute arbitrary code when the victim performs a subsequent Git operation (e.g., fetch, pull, push) that utilizes SSH, posing a significant threat to developers and CI/CD pipelines.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious submodule name, such as <code>'x&quot;] [core] sshCommand=CMD #'</code>, designed to close the legitimate <code>[submodule &quot;</code> section and open a new <code>[core]</code> section with an injected <code>sshCommand</code>.</li>
<li>The attacker convinces a victim to either use <code>Repo.create_submodule</code> with this malicious name (e.g., in a development tool or application accepting untrusted input) or to clone an untrusted Git repository containing this malicious submodule name in its <code>.gitmodules</code> file and then execute <code>submodule_update</code>.</li>
<li>GitPython's config writer (e.g., <code>fp.write((&quot;[%s]\n&quot; % name).encode(defenc))</code>) processes the crafted submodule name without adequately escaping the special characters.</li>
<li>The malicious name is written into the victim's repository-local <code>.git/config</code> file, resulting in an entry like <code>[submodule &quot;x&quot;] [core] sshCommand=CMD #&quot;]</code>.</li>
<li>The Git client parses this malformed entry, treating <code>[core] sshCommand=CMD</code> as a valid configuration directive due to the unescaped <code>]</code> closing the <code>submodule</code> section and <code>[</code> opening a new <code>core</code> section on the same line.</li>
<li>The <code>core.sshCommand</code> configuration is now set to an attacker-controlled command (e.g., <code>CMD</code>).</li>
<li>Upon the victim's next Git operation that requires SSH (e.g., <code>git fetch</code>, <code>git pull</code>, <code>git push</code>), the configured <code>core.sshCommand</code> is executed by the system.</li>
<li>The attacker's command <code>CMD</code> is executed on the victim's machine, achieving remote code execution.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability grants attackers arbitrary code execution on the victim's system, operating under the privileges of the user executing the Git operation. This can lead to complete system compromise, data exfiltration, or further lateral movement within an organization's network. The attack is highly effective because it leverages Git's trusted configuration mechanism. It can be triggered by common Git operations like <code>fetch</code>, <code>pull</code>, or <code>push</code> that use SSH, affecting developers, CI/CD systems, and any environment processing Git repositories with GitPython. While primarily observed as a Unix vector for the <code>clone_from</code> + <code>submodule_update</code> path, the direct <code>create_submodule</code> API sink remains exploitable across Windows, Linux, and macOS platforms.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade GitPython to a version greater than 3.1.52 immediately to remediate GHSA-3rp5-jjmw-4wv2.</li>
<li>Implement rigorous input validation and sanitization for any application that constructs Git submodules from untrusted input using <code>Repo.create_submodule</code>.</li>
<li>Educate users to exercise caution when cloning or initializing submodules from untrusted or unfamiliar Git repositories, as this can be a vector for <code>core.sshCommand</code> injection.</li>
<li>Monitor process creation logs for unusual commands executed by Git or SSH processes, as this could indicate RCE via an injected <code>core.sshCommand</code> (requires enabling Sysmon or similar granular logging).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>code-injection</category><category>rce</category><category>python</category><category>git</category><category>supply-chain</category></item></channel></rss>