<?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.49) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gitpython--3.1.49/</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, 08 May 2026 23:19:02 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gitpython--3.1.49/feed.xml" rel="self" type="application/rss+xml"/><item><title>GitPython config_writer() Newline Injection Bypasses CVE-2026-42215 Patch</title><link>https://feed.craftedsignal.io/briefs/2026-05-gitpython-newline-injection/</link><pubDate>Fri, 08 May 2026 23:19:02 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-05-gitpython-newline-injection/</guid><description>An incomplete patch for CVE-2026-42215 in GitPython allows newline injection in the section parameter of the config_writer() function, enabling arbitrary .git/config modification and remote code execution via core.hooksPath.</description><content:encoded><![CDATA[<p>GitPython versions 3.1.49 and earlier are vulnerable to newline injection in the <code>config_writer()</code> function. The patch for CVE-2026-42215, intended to prevent arbitrary configuration modification and RCE, only validates the <code>value</code> parameter of the <code>set_value()</code> function, neglecting to validate the <code>section</code> and <code>option</code> parameters. This oversight allows an attacker to inject newline characters into the <code>section</code> parameter, enabling the writing of arbitrary section headers into the <code>.git/config</code> file. By forging a <code>[core]</code> section with a malicious <code>hooksPath</code>, attackers can achieve remote code execution when a git hook is triggered. This vulnerability allows a bypass of the intended protection provided by the CVE-2026-42215 patch and effectively re-introduces the original vulnerability.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker gains control over a GitPython application or code that uses the <code>config_writer()</code> function.</li>
<li>The attacker crafts a malicious <code>section</code> string containing newline characters (e.g., <code>user]\n[core</code>).</li>
<li>The attacker calls <code>config_writer().set_value()</code> with the crafted <code>section</code>, the <code>option</code> set to <code>hooksPath</code>, and a <code>value</code> pointing to an attacker-controlled directory (e.g., <code>/tmp/evil_hooks</code>).</li>
<li>The <code>set_value()</code> function writes the crafted <code>section</code> string (e.g., <code>[user]\n[core]\n</code>) into the <code>.git/config</code> file, creating a new <code>[core]</code> section or modifying an existing one.</li>
<li>The <code>hooksPath</code> option within the injected <code>[core]</code> section is set to the attacker-controlled directory.</li>
<li>The attacker places a malicious script (e.g., <code>pre-commit</code>) within the attacker-controlled directory and makes it executable.</li>
<li>A git hook is triggered (e.g., by running <code>git commit</code>).</li>
<li>The malicious script is executed, resulting in remote code execution.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows attackers to execute arbitrary code on the target system, potentially leading to full system compromise. The impact is similar to CVE-2026-42215. This bypass is particularly damaging as organizations may believe they are protected by patching to version 3.1.49, while they remain vulnerable. There is no information regarding the number of victims or specific sectors targeted, but any application using a vulnerable version of GitPython is at risk.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply input validation to the <code>section</code> and <code>option</code> parameters of the <code>set_value()</code> function in <code>git/config.py</code> to prevent newline injection.</li>
<li>Upgrade GitPython to a version beyond 3.1.49 if a new version addressing this bypass is released.</li>
<li>Monitor process creation events for execution of scripts from unusual or attacker-controlled directories defined in <code>core.hooksPath</code>, using a Sigma rule such as the one provided below.</li>
<li>Regularly audit <code>.git/config</code> files for unexpected or suspicious configurations, especially for modifications to <code>core.hooksPath</code>.</li>
<li>Deploy the Sigma rules in this brief to your SIEM and tune for your environment.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>gitpython</category><category>newline-injection</category><category>rce</category><category>code-injection</category></item></channel></rss>