Skip to main content

apko CVE-2026-42574

HIGH
Path Traversal (CWE-22)
2026-05-04 https://github.com/chainguard-dev/apko GHSA-qq3r-w4hj-gjp6
7.5
CVSS 3.1 · Vendor: https://github.com/chainguard-dev/apko
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker crafts malicious APK
  2. Delivery
    Victim build pipeline ingests APK
  3. Exploit
    apko/melange extracts tar entries
  4. Install
    TypeSymlink entry creates escape vector
  5. C2
    Subsequent file/dir entry traverses symlink
  6. Execute
    Write to arbitrary host path
  7. Impact
    Persistence or supply-chain compromise

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the target to invoke disk-backed APK extraction operations-specifically apko build-cpio or direct use of the pkg/apk/fs DirFS package-against an attacker-controlled or attacker-influenced .apk archive. The vulnerable code paths are MkdirAll, Mkdir, WriteFile (reachable from malicious APK during tar extraction), plus ReadFile, Chmod, Chown, Chtimes, and Mknod (reachable by direct pkg/apk/fs API callers). NOT affected: in-memory tarfs operations used by apko build, apko publish, and apko build-minirootfs. The build process must have filesystem write access to paths outside the build root for the traversal to succeed-sandboxed builds with mount namespaces or chroot may limit impact but do not prevent the vulnerability from triggering. No authentication, non-default configuration, or user interaction is required once the malicious APK enters the build pipeline; the CVSS vector AV:N/AC:L/PR:N/UI:N reflects that the APK processing itself is automatic. Exploitation is limited by the need to deliver the malicious package to a build environment that trusts or processes it, making this primarily a supply-chain attack vector rather than direct remote exploitation.

Impact

Real-world risk is elevated for container build pipelines processing untrusted or unverified APK packages. CVSS 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N) suggests remote unauthenticated exploitation with high integrity impact, but the attack vector requires social engineering or supply-chain positioning: the malicious APK must be consumed during a build operation via apko build-cpio or tools embedding the vulnerable pkg/apk/fs (notably melange). The advisory explicitly states no public exploit identified at time of analysis beyond vendor-provided regression tests, and no CISA KEV listing indicates no confirmed active exploitation in the wild. However, the technical barrier is low once an attacker can inject a crafted APK into a build pipeline-the exploit is deterministic and does not require race conditions or information disclosure. EPSS data is unavailable but would likely be moderate given the supply-chain attack surface. SSVC decision factors: Exploitation status is publicly available exploit code exists (regression tests demonstrate primitives); automatable (yes, once APK is ingested); technical impact is partial (arbitrary file write within build user privileges, not full system compromise). Priority depends on whether your environment processes third-party or unvetted APKs. Organizations using apko/melange in CI/CD with strict package provenance and signature verification have reduced exposure, but upgrade is strongly recommended as the advisory states no complete workaround exists. The related CVE-2026-25121 indicates this is the second path-traversal fix in the same codebase, suggesting prior remediation was incomplete-a pattern that warrants scrutiny.

Exploit ScenarioDerived

An attacker publishes a malicious Alpine package to a compromised or attacker-controlled APK repository, or contributes a malicious package to an open-source project's package feed. The crafted .apk contains a tar entry of TypeSymlink named 'evil' with target '/home/builder/.ssh', followed by a TypeReg entry named 'evil/authorized_keys' containing the attacker's SSH public key. When a CI/CD pipeline running melange or apko build-cpio processes this package during a container image build, the vulnerable DirFS code creates the symlink inside the build root, then follows it when writing the authorized_keys file, installing the attacker's key into the build user's SSH configuration on the host. The attacker gains SSH access to the build infrastructure with the privileges of the build service account, enabling supply-chain compromise of all artifacts produced by that builder.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 04, 2026

Symlink-following path traversal in apko (versions 0.14.8 through <1.2.5) allows malicious APK archives to write arbitrary files to host paths during build operations. A crafted .apk can install a symlink entry pointing outside the build root, then traverse that symlink via subsequent file-write or directory-creation operations to reach any path writable by the build user. Affects disk-backed operations in apko build-cpio and downstream tools like melange; in-memory tarfs paths (apko build, apko publish) are not vulnerable. Vendor-released patch available in apko v1.2.5. CVSS 7.5 (AV:N/AC:L/PR:N/UI:N) indicates network-reachable unauthenticated exploitation, though practical attack requires convincing a target to process the malicious APK during a build. No EPSS or KEV data available; publicly available exploit code exists in the form of regression tests demonstrating each primitive.

RemediationAI

Upgrade to apko version 1.2.5 or later, which replaces the flawed sanitizePath logic with Go 1.24's *os.Root API that blocks symlink and hardlink traversal by construction (commit f5a96e1299ac81c7ea9441705ec467688086f442, PR #2187 at https://github.com/chainguard-dev/apko/pull/2187). Organizations using downstream tools like melange must ensure those tools have updated their apko dependency to 1.2.5+. The vendor advisory explicitly states no complete workaround exists for pre-1.2.5 versions. Partial risk reduction: restrict APK ingestion to packages from cryptographically signed, trusted sources with verified provenance, though the advisory notes this reduces but does not eliminate exposure (a compromised or malicious signed source could still deliver the exploit). For build environments that cannot immediately upgrade, implement host-level sandboxing: run apko/melange inside isolated containers or VMs with restricted filesystem access using mount namespaces, seccomp, or mandatory access controls (SELinux/AppArmor) that prevent writes outside the build root-this contains but does not prevent exploitation and may break legitimate build operations requiring host access. Monitor build logs for unexpected file-creation failures outside expected paths as a detection mechanism. Do not rely on input validation or tar-entry filtering in user space, as the advisory demonstrates multiple bypass primitives (absolute symlinks, relative symlinks, hardlink newname traversal).

Affected Packages

go chainguard.dev/apko fix: 1.2.5

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in go

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

This vulnerability affects apko, a Chainguard tool for building Alpine Package Keeper (APK)-based OCI container images, and its embedded pkg/apk/fs package. The root cause (CWE-22: Improper Limitation of a Pathname to a Restricted Directory) was in the sanitizePath helper in pkg/apk/fs/rwosfs.go, which validated paths only for lexical .. traversal but did not resolve or block symlinks. When a DirFS (disk-backed filesystem abstraction) processed tar entries during APK extraction, every method that handed caller-supplied paths to symlink-following Go standard library calls was vulnerable: ReadFile, WriteFile, Chmod, Chown, Chtimes, MkdirAll, Mkdir, and Mknod. An attacker could embed a TypeSymlink tar entry with an absolute target (/tmp/outside) or relative target (../outside) pointing beyond the build root, then include a subsequent TypeReg (file) or TypeDir (directory) entry whose name traversed that symlink (e.g., evil/pwned where evil is the planted symlink). The vulnerable code would follow the symlink and write to the attacker-controlled location on the host filesystem. This is a classic tar-slip variant leveraging symlinks rather than .. path components. The fix in v1.2.5 migrated all DirFS operations to Go 1.24's *os.Root API, which refuses traversal via .., absolute-target symlinks, relative-target symlinks, and hardlinks by design, replacing the flawed custom sanitizePath logic.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/chainguard-dev/apko) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
SUSE HIGH

Primary rating from Vendor (https://github.com/chainguard-dev/apko).

CVSS VectorVendor: https://github.com/chainguard-dev/apko

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

DescriptionCVE.org

Impact

A crafted .apk could install a TypeSymlink tar entry whose target pointed outside the build root, and a subsequent directory-creation or file-write entry in the same or later archive could traverse that symlink to reach host paths the build user could write to. The root cause was the sanitizePath helper in pkg/apk/fs/rwosfs.go, which rejected only lexical .. traversal and did not resolve or refuse symlinks. Every disk-backed DirFS method that handed its caller-supplied path to a symlink-following stdlib call - ReadFile, WriteFile, Chmod, Chown, Chtimes, MkdirAll, Mkdir, and Mknod - was affected. The reachable primitive from a malicious APK during tar extraction is the MkdirAll / Mkdir / WriteFile chain via apko build-cpio and disk-backed consumers such as melange; the remaining sinks are reachable by direct callers of the pkg/apk/fs package. The in-memory tarfs install path used by apko build, apko publish, and apko build-minirootfs is not affected.

Patches

Fixed in apko v1.2.5 by #2187 / commit f5a96e1, which scopes all DirFS operations through a Go 1.24 *os.Root. The sanitizePath helper has been removed; *os.Root refuses traversal via .., absolute-target symlinks, relative-target symlinks, and hardlinks by construction. Regression tests in pkg/apk/apk/path_traversal_test.go cover each composite primitive.

Workarounds

No complete workaround. Operators running pre-1.2.5 apko (or downstream tools such as melange that embed pre-1.2.5 pkg/apk/fs) should upgrade. Consuming only APKs from trusted, signed sources reduces but does not eliminate exposure.

Resources

  • https://github.com/chainguard-dev/apko/pull/2187
  • https://github.com/chainguard-dev/apko/commit/f5a96e1299ac81c7ea9441705ec467688086f442
  • https://github.com/chainguard-dev/apko/releases/tag/v1.2.5
  • Related: GHSA-5g94-c2wx-8pxw (CVE-2026-25121) - prior lexical .. traversal fix

Credits

apko thanks Oleh Konko (@1seal from 1seal.org) for the initial report of the symlink-escape class, and to @Xh081iX for a follow-up set of reports covering additional reachable primitives (ReadFile, Chmod/Chown, Mknod, MkdirAll/Mkdir) that shaped the comprehensive fix.

Executive ViewAI

Why It Matters

Symlink-following path traversal in apko versions 0.14.8 through 1.2.4 allows attackers to write arbitrary files to the host system during container image builds when processing malicious APK archives. Organizations using apko for image builds, particularly those integrating with melange or processing untrusted APK sources, risk unauthorized file modification and potential supply-chain compromise of built container images.

Business Impact: High
Compensating Controls

Vendor-released patch: apko v1.2.5. Until patching is complete, restrict apko build operations to isolated, air-gapped build environments; disable processing of APK archives from untrusted sources; implement strict file-system monitoring on build systems to detect unauthorized writes outside designated build directories.

Threat Intelligence Overview

EPSS Score
0.1%
Top 84% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:go/chainguard.dev_apko

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy