<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>liblzma Archives - George Gerontakis</title>
	<atom:link href="https://blog.gerontakis.eu/tag/liblzma/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gerontakis.eu/tag/liblzma/</link>
	<description>My personal Blog and more 😎</description>
	<lastBuildDate>Sat, 30 Mar 2024 23:09:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Backdoor in Upstream xz/liblzma Leading to SSH Server Compromise</title>
		<link>https://blog.gerontakis.eu/2024/03/30/backdoor-in-upstream-xz-liblzma-leading-to-ssh-server-compromise/</link>
					<comments>https://blog.gerontakis.eu/2024/03/30/backdoor-in-upstream-xz-liblzma-leading-to-ssh-server-compromise/#respond</comments>
		
		<dc:creator><![CDATA[g.gerontakis]]></dc:creator>
		<pubDate>Sat, 30 Mar 2024 17:04:32 +0000</pubDate>
				<category><![CDATA[Backdoor]]></category>
		<category><![CDATA[Urgent Alert]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[liblzma]]></category>
		<category><![CDATA[liblzma Vulnerability]]></category>
		<category><![CDATA[SSH Server Security]]></category>
		<category><![CDATA[xz Compression Library Backdoor]]></category>
		<guid isPermaLink="false">https://blog.gerontakis.eu/?p=131</guid>

					<description><![CDATA[<p>Are you worried about the security of your SSH server? A recent discovery has unveiled a sophisticated backdoor in the upstream xz compression library (liblzma), impacting versions 5.6.0 and 5.6.1. This vulnerability directly affects systems exposing SSH to the internet, leading to unauthorized access and potential compromise. The injected code within the xz/liblzma library was [&#8230;]</p>
<p>The post <a href="https://blog.gerontakis.eu/2024/03/30/backdoor-in-upstream-xz-liblzma-leading-to-ssh-server-compromise/">Backdoor in Upstream xz/liblzma Leading to SSH Server Compromise</a> appeared first on <a href="https://blog.gerontakis.eu">George Gerontakis</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1024" height="1024" src="https://blog.gerontakis.eu/wp-content/uploads/2024/03/backdoor_post_image.webp" alt="" class="wp-image-133" srcset="https://blog.gerontakis.eu/wp-content/uploads/2024/03/backdoor_post_image.webp 1024w, https://blog.gerontakis.eu/wp-content/uploads/2024/03/backdoor_post_image-300x300.webp 300w, https://blog.gerontakis.eu/wp-content/uploads/2024/03/backdoor_post_image-150x150.webp 150w, https://blog.gerontakis.eu/wp-content/uploads/2024/03/backdoor_post_image-768x768.webp 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"><strong>Are you worried about the security of your SSH server?</strong> A recent discovery has unveiled a sophisticated backdoor in the upstream xz compression library (<code>liblzma</code>), impacting versions 5.6.0 and 5.6.1. This vulnerability directly affects systems exposing SSH to the internet, leading to unauthorized access and potential compromise.</p>



<span id="more-131"></span>



<p class="wp-block-paragraph"><strong>The injected code within the xz/liblzma library was designed to subtly execute unauthorized actions without detection</strong>. It cleverly modifies the build process to introduce malicious behavior, specifically targeting SSH server security. This backdoor compromises systems by allowing external control under certain conditions, significantly impacting system integrity and data confidentiality. The sophistication of this attack underlines the importance of rigorous software supply chain security measures.</p>



<p class="wp-block-paragraph"><strong>The author of the backdoor made attempts to have the compromised xz version 5.6.x added to Fedora 40 and 41</strong>. This move was likely aimed at widening the backdoor&#8217;s impact by integrating it into more systems, showcasing a deliberate effort to infiltrate open-source software distributions at a foundational level.</p>



<p class="wp-block-paragraph">Vegard Nossum wrote a script to detect if it&#8217;s likely that the ssh binary on a system is vulnerable:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">ShellScript</span><span role="button" tabindex="0" data-code="#! /bin/bash

set -eu

# find path to liblzma used by sshd
path=&quot;$(ldd $(which sshd) | grep liblzma | grep -o '/[^ ]*')&quot;

# does it even exist?
if [ &quot;$path&quot; == &quot;&quot; ]
then
	echo probably not vulnerable
	exit
fi

# check for function signature
if hexdump -ve '1/1 &quot;%.2x&quot;' &quot;$path&quot; | grep -q f30f1efa554889f54c89ce5389fb81e7000000804883ec28488954241848894c2410
then
	echo probably vulnerable
else
	echo probably not vulnerable
fi
" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">#! /bin/bash</span></span>
<span class="line"></span>
<span class="line"><span style="color: #DCDCAA">set</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-eu</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955"># find path to liblzma used by sshd</span></span>
<span class="line"><span style="color: #9CDCFE">path</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;$(</span><span style="color: #DCDCAA">ldd</span><span style="color: #CE9178"> $(</span><span style="color: #DCDCAA">which</span><span style="color: #CE9178"> sshd) </span><span style="color: #D4D4D4">|</span><span style="color: #CE9178"> </span><span style="color: #DCDCAA">grep</span><span style="color: #CE9178"> liblzma </span><span style="color: #D4D4D4">|</span><span style="color: #CE9178"> </span><span style="color: #DCDCAA">grep</span><span style="color: #CE9178"> </span><span style="color: #569CD6">-o</span><span style="color: #CE9178"> &#39;/[^ ]*&#39;)&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955"># does it even exist?</span></span>
<span class="line"><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> [ </span><span style="color: #CE9178">&quot;</span><span style="color: #9CDCFE">$path</span><span style="color: #CE9178">&quot;</span><span style="color: #D4D4D4"> == </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4"> ]</span></span>
<span class="line"><span style="color: #C586C0">then</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">probably</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">not</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">vulnerable</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #DCDCAA">exit</span></span>
<span class="line"><span style="color: #C586C0">fi</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955"># check for function signature</span></span>
<span class="line"><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">hexdump</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-ve</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&#39;1/1 &quot;%.2x&quot;&#39;</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;</span><span style="color: #9CDCFE">$path</span><span style="color: #CE9178">&quot;</span><span style="color: #D4D4D4"> | </span><span style="color: #DCDCAA">grep</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-q</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">f30f1efa554889f54c89ce5389fb81e7000000804883ec28488954241848894c2410</span></span>
<span class="line"><span style="color: #C586C0">then</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">probably</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">vulnerable</span></span>
<span class="line"><span style="color: #C586C0">else</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">probably</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">not</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">vulnerable</span></span>
<span class="line"><span style="color: #C586C0">fi</span></span>
<span class="line"></span></code></pre></div>



<h3 class="wp-block-heading">How Did This Happen?</h3>



<p class="wp-block-paragraph">A subtle script introduced in the <code>xz</code> tarballs modifies the Makefile during the configuration process, injecting malicious code into the <code>liblzma</code> library. This targeted approach impacts systems built with gcc and the GNU linker, particularly those in Debian or RPM package builds.</p>



<h3 class="wp-block-heading">How to Check if You&#8217;re Affected?</h3>



<ul class="wp-block-list">
<li><strong>SSH Slowdown:</strong> A significant slowdown during SSH logins could indicate compromise.</li>



<li><strong>Version Check:</strong> Verify your <code>liblzma</code> version. Affected versions are 5.6.0 and 5.6.1. (<code>xz --version</code>)</li>



<li><strong>Look for Unusual Processes:</strong> Monitor for unexpected processes or connections, indicative of malicious activity.</li>



<li><strong>Use the aforementioned shell script</strong> </li>
</ul>



<h3 class="wp-block-heading">Immediate Remediation Steps:</h3>



<ol class="wp-block-list">
<li><strong>Downgrade liblzma:</strong> Ensure you&#8217;re running a secure version of <code>liblzma</code>, free from the backdoor.</li>



<li><strong>Use Detection Scripts:</strong> Employ scripts to scan for compromised SSH binaries.</li>
</ol>



<h3 class="wp-block-heading">For the Technically Inclined:</h3>



<p class="wp-block-paragraph">The backdoor manipulation involves sophisticated code injection techniques that evade typical detection methods. This underscores the necessity for rigorous security protocols and the continuous monitoring of system libraries for anomalies.</p>



<p class="wp-block-paragraph">This incident is a stark reminder of the vulnerabilities that can exist in the supply chain and the continuous need for vigilance in system security practices. For more advanced users, it&#8217;s advisable to engage in comprehensive log analysis and employ enhanced detection tools to safeguard against such sophisticated threats.</p>



<p class="wp-block-paragraph"><strong>References:</strong></p>



<ul class="wp-block-list">
<li><a href="https://news.ycombinator.com/item?id=39865810">https://news.ycombinator.com/item?id=39865810</a></li>



<li><a href="https://www.openwall.com/lists/oss-security/2024/03/29/4">https://www.openwall.com/lists/oss-security/2024/03/29/4</a></li>



<li><a href="https://news.opensuse.org/2024/03/29/xz-backdoor/">https://news.opensuse.org/2024/03/29/xz-backdoor/</a></li>
</ul>
<p>The post <a href="https://blog.gerontakis.eu/2024/03/30/backdoor-in-upstream-xz-liblzma-leading-to-ssh-server-compromise/">Backdoor in Upstream xz/liblzma Leading to SSH Server Compromise</a> appeared first on <a href="https://blog.gerontakis.eu">George Gerontakis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gerontakis.eu/2024/03/30/backdoor-in-upstream-xz-liblzma-leading-to-ssh-server-compromise/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
