CVE-2026-28406: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in chainguard-forks kaniko
kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster. Starting in version 1.25.4 and prior to version 1.25.10, kaniko unpacks build context archives using `filepath.Join(dest, cleanedName)` without enforcing that the final path stays within `dest`. A tar entry like `../outside.txt` escapes the extraction root and writes files outside the destination directory. In environments with registry authentication, this can be chained with docker credential helpers to achieve code execution within the executor process. Version 1.25.10 uses securejoin for path resolution in tar extraction.
AI Analysis
Technical Summary
Kaniko is a tool designed to build container images from Dockerfiles within containerized or Kubernetes environments. Versions from 1.25.4 up to but not including 1.25.10 contain a path traversal vulnerability (CWE-22) identified as CVE-2026-28406. The vulnerability arises because kaniko unpacks build context archives by concatenating the destination directory path with the cleaned file name from the archive using filepath.Join(dest, cleanedName), but it does not verify that the resulting path remains inside the intended extraction root. Maliciously crafted tar archives can include entries with relative paths such as '../outside.txt', which escape the extraction directory and write files to arbitrary locations on the host filesystem. This can lead to unauthorized file writes outside the container build context. In scenarios where kaniko is used with registry authentication and docker credential helpers, attackers can chain this path traversal to execute arbitrary code within the kaniko executor process, potentially compromising the build environment. The issue was addressed in version 1.25.10 by switching to securejoin for path resolution during tar extraction, which enforces that extracted files remain within the designated directory. Although no active exploits have been reported, the vulnerability's nature and ease of exploitation make it a critical concern for organizations relying on kaniko for container image builds, especially in automated CI/CD pipelines and multi-tenant Kubernetes clusters.
Potential Impact
The vulnerability allows attackers to write files outside the intended extraction directory during container image builds, potentially overwriting critical files or planting malicious payloads. This can compromise the integrity of the build environment and lead to arbitrary code execution, particularly when combined with docker credential helpers in authenticated registry environments. Organizations using kaniko in automated build pipelines or Kubernetes clusters risk unauthorized access, persistent compromise, and lateral movement within their infrastructure. The impact extends to the integrity of container images produced, potentially leading to supply chain attacks if malicious code is embedded during the build process. Availability impact is low but could arise if critical system files are overwritten. Confidentiality impact is minimal directly but can escalate if code execution leads to data breaches. The vulnerability's ease of exploitation without authentication and no user interaction required increases its risk profile significantly.
Mitigation Recommendations
Upgrade kaniko to version 1.25.10 or later, which includes the fix using securejoin for safe path resolution during tar extraction. Until upgrading is possible, implement strict validation and sanitization of build context archives to ensure no path traversal entries exist before processing. Restrict kaniko execution privileges using container security best practices such as running with least privilege, read-only file systems, and user namespaces to limit the impact of potential exploitation. Monitor build logs and filesystem changes during image builds for unexpected file writes outside the build context. Employ network segmentation and access controls to limit kaniko's ability to interact with credential helpers or sensitive host resources. Regularly audit and rotate credentials used in registry authentication to reduce the risk of credential theft if exploitation occurs. Consider using alternative container build tools with verified secure extraction mechanisms if immediate patching is not feasible.
Affected Countries
United States, Germany, China, India, United Kingdom, Canada, France, Japan, Australia, Netherlands
CVE-2026-28406: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in chainguard-forks kaniko
Description
kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster. Starting in version 1.25.4 and prior to version 1.25.10, kaniko unpacks build context archives using `filepath.Join(dest, cleanedName)` without enforcing that the final path stays within `dest`. A tar entry like `../outside.txt` escapes the extraction root and writes files outside the destination directory. In environments with registry authentication, this can be chained with docker credential helpers to achieve code execution within the executor process. Version 1.25.10 uses securejoin for path resolution in tar extraction.
AI-Powered Analysis
Technical Analysis
Kaniko is a tool designed to build container images from Dockerfiles within containerized or Kubernetes environments. Versions from 1.25.4 up to but not including 1.25.10 contain a path traversal vulnerability (CWE-22) identified as CVE-2026-28406. The vulnerability arises because kaniko unpacks build context archives by concatenating the destination directory path with the cleaned file name from the archive using filepath.Join(dest, cleanedName), but it does not verify that the resulting path remains inside the intended extraction root. Maliciously crafted tar archives can include entries with relative paths such as '../outside.txt', which escape the extraction directory and write files to arbitrary locations on the host filesystem. This can lead to unauthorized file writes outside the container build context. In scenarios where kaniko is used with registry authentication and docker credential helpers, attackers can chain this path traversal to execute arbitrary code within the kaniko executor process, potentially compromising the build environment. The issue was addressed in version 1.25.10 by switching to securejoin for path resolution during tar extraction, which enforces that extracted files remain within the designated directory. Although no active exploits have been reported, the vulnerability's nature and ease of exploitation make it a critical concern for organizations relying on kaniko for container image builds, especially in automated CI/CD pipelines and multi-tenant Kubernetes clusters.
Potential Impact
The vulnerability allows attackers to write files outside the intended extraction directory during container image builds, potentially overwriting critical files or planting malicious payloads. This can compromise the integrity of the build environment and lead to arbitrary code execution, particularly when combined with docker credential helpers in authenticated registry environments. Organizations using kaniko in automated build pipelines or Kubernetes clusters risk unauthorized access, persistent compromise, and lateral movement within their infrastructure. The impact extends to the integrity of container images produced, potentially leading to supply chain attacks if malicious code is embedded during the build process. Availability impact is low but could arise if critical system files are overwritten. Confidentiality impact is minimal directly but can escalate if code execution leads to data breaches. The vulnerability's ease of exploitation without authentication and no user interaction required increases its risk profile significantly.
Mitigation Recommendations
Upgrade kaniko to version 1.25.10 or later, which includes the fix using securejoin for safe path resolution during tar extraction. Until upgrading is possible, implement strict validation and sanitization of build context archives to ensure no path traversal entries exist before processing. Restrict kaniko execution privileges using container security best practices such as running with least privilege, read-only file systems, and user namespaces to limit the impact of potential exploitation. Monitor build logs and filesystem changes during image builds for unexpected file writes outside the build context. Employ network segmentation and access controls to limit kaniko's ability to interact with credential helpers or sensitive host resources. Regularly audit and rotate credentials used in registry authentication to reduce the risk of credential theft if exploitation occurs. Consider using alternative container build tools with verified secure extraction mechanisms if immediate patching is not feasible.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-27T15:33:57.289Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 69a20f8732ffcdb8a275da1b
Added to database: 2/27/2026, 9:41:27 PM
Last enriched: 2/27/2026, 9:55:25 PM
Last updated: 2/27/2026, 10:53:51 PM
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-11252: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in Signum Technology Promotion and Training Inc. windesk.fm
CriticalCVE-2026-2647
LowCVE-2026-28425: CWE-94: Improper Control of Generation of Code ('Code Injection') in statamic cms
HighCVE-2026-28424: CWE-862: Missing Authorization in statamic cms
MediumCVE-2026-28423: CWE-918: Server-Side Request Forgery (SSRF) in statamic cms
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.