<?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>Chainguard — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/chainguard/</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/vendors/chainguard/feed.xml" rel="self" type="application/rss+xml"/><item><title>Apko Package Substitution Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-apko-package-substitution/</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-apko-package-substitution/</guid><description>Apko versions prior to 1.2.7 are vulnerable to package substitution due to not verifying downloaded apk packages against the APKINDEX checksum, potentially allowing an attacker who can substitute download responses to install arbitrary packages into built images.</description><content:encoded><![CDATA[<p>Apko, a tool for building container images, is susceptible to a critical package substitution vulnerability in versions prior to 1.2.7. The vulnerability stems from the tool&rsquo;s failure to validate downloaded <code>.apk</code> packages against the checksums recorded in the signed <code>APKINDEX.tar.gz</code> file. While Apko does verify the signature on the index and parses the checksums, it does not compare these checksums against the downloaded packages during the <code>getPackageImpl()</code> function. This oversight can allow an attacker with the ability to manipulate download responses, such as through compromised mirrors, HTTP repositories, or poisoned CDN caches, to inject malicious or unintended packages into the built container images. This issue was reported by Oleh Konko from 1seal.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker compromises a mirror, HTTP repository, or poisons a CDN cache used by apko.</li>
<li>A user initiates an apko build process, specifying a package to be included in the image.</li>
<li>Apko requests the specified package from the compromised source.</li>
<li>The attacker substitutes the legitimate package with a malicious or altered <code>.apk</code> package.</li>
<li>Apko downloads the substituted package.</li>
<li>Apko verifies the signature on <code>APKINDEX.tar.gz</code> but fails to validate the downloaded <code>.apk</code> package against the checksum in the index.</li>
<li>Apko installs the malicious or altered package into the container image.</li>
<li>The resulting container image is built with the compromised package, potentially leading to arbitrary code execution or other malicious activity when the image is deployed.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an attacker to inject arbitrary packages into container images built with vulnerable versions of apko. This can lead to a variety of adverse outcomes, including arbitrary code execution within containers, data exfiltration, and denial-of-service attacks. The lack of package validation provides a significant opportunity for attackers to compromise the integrity of containerized applications and infrastructure.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to apko version 1.2.7 or later once a fix is available from the vendor.</li>
<li>Monitor network traffic for unexpected connections to untrusted or unusual package repositories using network connection logs and create rules to alert on such activity.</li>
<li>Implement integrity monitoring on the build system to detect unauthorized modification of files, specifically focusing on downloaded packages. This can be achieved through file integrity monitoring tools that generate file_event logs.</li>
<li>Deploy the provided Sigma rule to detect suspicious process executions within containers shortly after the build process.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>package-substitution</category><category>supply-chain</category><category>linux</category></item><item><title>Apko DirFS Symlink Path Traversal Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-apko-path-traversal/</link><pubDate>Tue, 02 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-apko-path-traversal/</guid><description>A symlink-following path traversal vulnerability exists in apko versions prior to 1.2.5 allowing a malicious .apk file to create a symbolic link pointing outside the build root and subsequently modify files on the host system.</description><content:encoded><![CDATA[<p>A path traversal vulnerability exists in apko&rsquo;s <code>DirFS</code> component, specifically within the <code>sanitizePath</code> helper function in versions prior to 1.2.5. The vulnerability allows a malicious <code>.apk</code> file to install a <code>TypeSymlink</code> tar entry pointing outside the intended build root. Subsequent directory creation or file writing operations could then traverse this symbolic link, leading to unauthorized access and modification of files on the host system. This issue affects users of apko and downstream tools, such as melange, that embed vulnerable versions of the <code>pkg/apk/fs</code> package. The vulnerability was addressed in apko version 1.2.5 with the introduction of <code>*os.Root</code>, which prevents path traversal.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious <code>.apk</code> file containing a <code>TypeSymlink</code> tar entry.</li>
<li>The symbolic link&rsquo;s target is set to a path outside the intended build root, potentially targeting sensitive system directories.</li>
<li>The malicious <code>.apk</code> is processed using a vulnerable version of apko (prior to 1.2.5) via commands like <code>apko build-cpio</code> or through disk-backed consumers such as <code>melange</code>.</li>
<li>During tar extraction, the vulnerable <code>sanitizePath</code> function fails to properly resolve or refuse the malicious symlink.</li>
<li>A subsequent directory-creation or file-write operation is initiated within the same or a later archive entry.</li>
<li>The file operation traverses the previously created symbolic link, gaining access to the file system location outside the intended build root.</li>
<li>The attacker can then create directories or write files to the compromised location, potentially overwriting critical system files or injecting malicious code.</li>
<li>Successful exploitation can lead to privilege escalation and persistent compromise of the host system.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an attacker to write files to arbitrary locations on the host system. This can lead to privilege escalation if the attacker can overwrite setuid binaries or modify system configuration files. It can also lead to persistent compromise of the system if the attacker injects malicious code into startup scripts or other system files. While the exact number of victims is unknown, any system running a vulnerable version of apko (prior to 1.2.5) or tools embedding vulnerable versions of <code>pkg/apk/fs</code>, such as melange, is potentially at risk.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade apko to version 1.2.5 or later. This version includes a fix that prevents path traversal vulnerabilities as described in the advisory and commit <a href="https://github.com/chainguard-dev/apko/commit/f5a96e1299ac81c7ea9441705ec467688086f442">f5a96e1</a>.</li>
<li>If upgrading is not immediately feasible, avoid consuming APKs from untrusted sources. However, note that this does not fully eliminate the risk.</li>
<li>Monitor file creation events in sensitive directories for unexpected activity, especially after processing <code>.apk</code> files.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>symlink</category><category>apko</category><category>vulnerability</category><category>CVE-2026-42574</category></item></channel></rss>