<?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.53 - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gitpython--3.1.53/</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:45:20 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gitpython--3.1.53/feed.xml" rel="self" type="application/rss+xml"/><item><title>GitPython Incomplete Denylist Allows Arbitrary Command Execution via Git Clone Hooks</title><link>https://feed.craftedsignal.io/briefs/2026-07-gitpython-unsafe-git-clone-options/</link><pubDate>Fri, 24 Jul 2026 16:45:20 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-gitpython-unsafe-git-clone-options/</guid><description>A critical vulnerability in GitPython versions up to 3.1.53 allows attackers to achieve arbitrary command execution by influencing `git clone` options to include a malicious `--template` directory, which causes Git hooks to be copied and executed during cloning, even in default configurations.</description><content:encoded><![CDATA[<p>A high-severity vulnerability exists in GitPython versions up to and including 3.1.53, stemming from an incomplete denylist within the <code>unsafe_git_clone_options</code> mechanism. Specifically, the <code>--template</code> option for <code>git clone</code> is not blocked, allowing an attacker to specify a path to an attacker-controlled directory containing malicious Git hooks. When GitPython executes the underlying <code>git clone</code> command, these hooks, such as <code>post-checkout</code>, are copied into the new repository and subsequently executed during the checkout phase. This oversight leads to arbitrary command execution on the system hosting the GitPython application. The exploitation requires the attacker to provide an attacker-readable directory containing an executable hook, which can be realistic via shared filesystems, upload directories, or attacker-writable network paths. This flaw impacts all platforms where GitPython is used.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker crafts a malicious Git hook script (e.g., <code>post-checkout</code>) containing commands designed for arbitrary execution on the victim's system.</li>
<li>Attacker places this malicious script into a specially structured directory, such as <code>&lt;attacker_controlled_path&gt;/hooks/post-checkout</code>, ensuring it has executable permissions.</li>
<li>Attacker identifies a vulnerable GitPython application that performs <code>Repo.clone_from</code> operations and can be manipulated to accept an attacker-controlled value for the <code>template</code> argument.</li>
<li>The vulnerable GitPython application is tricked into initiating a <code>Repo.clone_from</code> call, passing the attacker-controlled path to the <code>template</code> parameter.</li>
<li>GitPython's internal <code>check_unsafe_options</code> function, intended to prevent dangerous <code>git clone</code> options, fails to block <code>--template</code> because it is missing from its <code>unsafe_git_clone_options</code> denylist.</li>
<li>The underlying <code>git</code> command is executed on the host system, including the <code>--template=&lt;attacker_controlled_path&gt;</code> option.</li>
<li>The <code>git</code> command copies the malicious <code>post-checkout</code> hook from <code>&lt;attacker_controlled_path&gt;/hooks/</code> to the newly cloned repository's <code>.git/hooks/</code> directory.</li>
<li>During the repository checkout process, which is part of the <code>git clone</code> operation, the newly copied malicious <code>post-checkout</code> hook is automatically executed, resulting in arbitrary command execution on the victim's system.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to arbitrary operating system command execution on the host running the GitPython application. An attacker could leverage this to install malware, exfiltrate sensitive data, establish persistence, or further compromise the affected system and network. While a second precondition of an attacker-readable directory with an executable hook is necessary, this is considered achievable in many real-world scenarios. This vulnerability affects any system using vulnerable versions of GitPython, regardless of the underlying operating system.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade GitPython to a patched version once available.</li>
<li>Implement host-based detection for unusual Git command-line parameters, specifically the <code>--template</code> option, by deploying the Sigma rule provided in this brief.</li>
<li>Monitor process creation logs for <code>git.exe</code> or <code>git</code> processes executing with unusual arguments or child processes that deviate from expected behavior for Git operations.</li>
<li>Restrict write permissions on directories that could be used by attackers to stage malicious Git hooks, such as temporary directories or shared network drives.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>git</category><category>python</category><category>vulnerability</category><category>rce</category></item></channel></rss>