CVE-2026-25121 Overview
A path traversal vulnerability has been identified in apko, a tool that allows users to build and publish OCI container images from apk packages. The vulnerability exists in apko's dirFS filesystem abstraction, where the MkdirAll, Mkdir, and Symlink methods in pkg/apk/fs/rwosfs.go use filepath.Join() without validating that the resulting path stays within the base directory. This flaw enables attackers to create directories or symlinks outside the intended installation root.
Critical Impact
An attacker who can supply a malicious APK package (e.g., via a compromised or typosquatted repository) could escape the installation root and write files to arbitrary locations on the host filesystem.
Affected Products
- apko versions 0.14.8 to before 1.1.1
Discovery Timeline
- 2026-02-04 - CVE CVE-2026-25121 published to NVD
- 2026-02-05 - Last updated in NVD database
Technical Details for CVE-2026-25121
Vulnerability Analysis
This path traversal vulnerability (CWE-23) occurs due to improper input validation in apko's filesystem abstraction layer. The affected code in pkg/apk/fs/rwosfs.go fails to sanitize user-controlled path components before joining them with the base directory. When processing APK packages, the MkdirAll, Mkdir, and Symlink methods directly concatenate paths using Go's filepath.Join() function without verifying that the resulting path remains within the intended directory boundary.
The vulnerability allows an attacker to break out of the container build environment's sandboxed filesystem by crafting malicious APK packages containing path components with directory traversal sequences (such as ../). Since Go's filepath.Join() cleans paths but does not prevent traversal above the base directory, an attacker-supplied path like ../../etc/malicious would resolve to a location outside the intended installation root.
Root Cause
The root cause is the missing boundary check after filepath.Join() operations in the filesystem abstraction layer. The MkdirAll, Mkdir, and Symlink methods in pkg/apk/fs/rwosfs.go fail to validate that the resolved path remains under the designated base directory. Proper remediation requires comparing the canonical resolved path against the base directory to ensure containment.
Attack Vector
The attack requires an attacker to supply a malicious APK package to a system running vulnerable versions of apko. This can be achieved through several vectors:
- Compromised Repository: Gaining access to an APK repository and injecting malicious packages
- Typosquatting: Creating packages with names similar to legitimate packages to trick users
- Man-in-the-Middle: Intercepting unprotected APK downloads and injecting malicious content
- Social Engineering: Convincing users to add untrusted repositories to their apko configuration
Once a malicious APK is processed, the attacker can create arbitrary directories or symlinks outside the installation root, potentially leading to arbitrary file writes or overwriting critical system files during the container build process.
The vulnerability is exploitable over the network without requiring authentication or user interaction. The impact is limited to integrity compromise, as the attacker can modify files outside the intended directory but cannot directly read sensitive data or cause denial of service through this vulnerability alone.
Detection Methods for CVE-2026-25121
Indicators of Compromise
- Unexpected directories or symlinks created outside the apko working directory during container builds
- APK packages containing path components with ../ sequences in filenames or paths
- Unusual file system modifications in parent directories of the apko installation root
- Build logs showing file operations targeting paths outside the expected container root
Detection Strategies
- Monitor apko build processes for file system operations that escape the designated build directory
- Implement file integrity monitoring on critical system directories during container build operations
- Audit APK package contents for suspicious path traversal patterns before processing
- Review container build logs for unexpected path resolutions or directory creations
Monitoring Recommendations
- Enable verbose logging for apko build operations to capture all filesystem activities
- Implement real-time alerting on filesystem changes in sensitive directories during builds
- Use sandbox environments with strict filesystem access controls for building untrusted images
- Monitor network connections to untrusted or recently registered APK repositories
How to Mitigate CVE-2026-25121
Immediate Actions Required
- Upgrade apko to version 1.1.1 or later immediately
- Audit all APK repositories configured in your environment for unauthorized packages
- Review recent container builds for signs of exploitation
- Implement network segmentation to restrict access to APK repositories from build systems
Patch Information
The vulnerability has been patched in apko version 1.1.1. The fix implements proper path validation to ensure that resolved paths remain within the intended base directory. Users should upgrade to version 1.1.1 or later to address this vulnerability.
For technical details on the patch, refer to the GitHub Commit Details and the GitHub Security Advisory GHSA-5g94-c2wx-8pxw.
Workarounds
- Restrict APK repository sources to only trusted, verified repositories until the patch can be applied
- Run apko builds in isolated environments with limited filesystem access
- Implement strict content scanning of APK packages before processing
- Use read-only bind mounts for sensitive host directories during container builds
# Configuration example
# Upgrade apko to patched version
go install chainguard.dev/apko@v1.1.1
# Verify installed version
apko version
# Run builds in isolated environment with restricted filesystem access
# Example using Docker to sandbox the build process
docker run --rm -v /path/to/config:/config:ro \
--read-only --tmpfs /tmp \
cgr.dev/chainguard/apko:latest build /config/apko.yaml output.tar
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


