{"description":"Trending threats, MITRE ATT\u0026CK coverage, and detection metadata — refreshed continuously.","feed_url":"https://feed.craftedsignal.io/tags/package-substitution/","home_page_url":"https://feed.craftedsignal.io/","items":[{"_cs_actors":[],"_cs_cves":[],"_cs_exploited":false,"_cs_products":["apko","go/chainguard.dev/apko"],"_cs_severities":["high"],"_cs_tags":["package-substitution","supply-chain","linux"],"_cs_type":"advisory","_cs_vendors":["Chainguard"],"content_html":"\u003cp\u003eApko, 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\u0026rsquo;s failure to validate downloaded \u003ccode\u003e.apk\u003c/code\u003e packages against the checksums recorded in the signed \u003ccode\u003eAPKINDEX.tar.gz\u003c/code\u003e 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 \u003ccode\u003egetPackageImpl()\u003c/code\u003e 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.\u003c/p\u003e\n\u003ch2 id=\"attack-chain\"\u003eAttack Chain\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eAttacker compromises a mirror, HTTP repository, or poisons a CDN cache used by apko.\u003c/li\u003e\n\u003cli\u003eA user initiates an apko build process, specifying a package to be included in the image.\u003c/li\u003e\n\u003cli\u003eApko requests the specified package from the compromised source.\u003c/li\u003e\n\u003cli\u003eThe attacker substitutes the legitimate package with a malicious or altered \u003ccode\u003e.apk\u003c/code\u003e package.\u003c/li\u003e\n\u003cli\u003eApko downloads the substituted package.\u003c/li\u003e\n\u003cli\u003eApko verifies the signature on \u003ccode\u003eAPKINDEX.tar.gz\u003c/code\u003e but fails to validate the downloaded \u003ccode\u003e.apk\u003c/code\u003e package against the checksum in the index.\u003c/li\u003e\n\u003cli\u003eApko installs the malicious or altered package into the container image.\u003c/li\u003e\n\u003cli\u003eThe resulting container image is built with the compromised package, potentially leading to arbitrary code execution or other malicious activity when the image is deployed.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"impact\"\u003eImpact\u003c/h2\u003e\n\u003cp\u003eSuccessful 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.\u003c/p\u003e\n\u003ch2 id=\"recommendation\"\u003eRecommendation\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eUpgrade to apko version 1.2.7 or later once a fix is available from the vendor.\u003c/li\u003e\n\u003cli\u003eMonitor network traffic for unexpected connections to untrusted or unusual package repositories using network connection logs and create rules to alert on such activity.\u003c/li\u003e\n\u003cli\u003eImplement 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.\u003c/li\u003e\n\u003cli\u003eDeploy the provided Sigma rule to detect suspicious process executions within containers shortly after the build process.\u003c/li\u003e\n\u003c/ul\u003e\n","date_modified":"2024-01-03T12:00:00Z","date_published":"2024-01-03T12:00:00Z","id":"/briefs/2024-01-apko-package-substitution/","summary":"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.","title":"Apko Package Substitution Vulnerability","url":"https://feed.craftedsignal.io/briefs/2024-01-apko-package-substitution/"}],"language":"en","title":"CraftedSignal Threat Feed — Package-Substitution","version":"https://jsonfeed.org/version/1.1"}