CVE-2026-15791 Overview
CVE-2026-15791 is a path traversal vulnerability [CWE-22] in the Moby BuildKit low-level build Application Programming Interface (API). A crafted message sent through the BuildKit low-level build API can escape the build container rootfs and delete the contents of the real host /tmp directory. The delete file action, which is intended to operate only inside the container filesystem, resolves paths outside the intended boundary and reaches the host temporary directory. Exploitation requires local access and user interaction with a malicious build definition, which limits practical risk but exposes host state to tampering by an untrusted build.
Critical Impact
A malicious BuildKit build definition can remove files from the host /tmp directory, potentially disrupting other services and processes that rely on temporary state.
Affected Products
- Moby BuildKit (low-level build API)
- Container build workflows using BuildKit as the backend
- Docker and Buildx installations that embed vulnerable BuildKit versions
Discovery Timeline
- 2026-07-21 - CVE-2026-15791 published to the National Vulnerability Database (NVD)
- 2026-07-21 - Last updated in NVD database
Technical Details for CVE-2026-15791
Vulnerability Analysis
The vulnerability resides in BuildKit's handling of file removal operations issued through the low-level build (LLB) API. BuildKit exposes a primitive that removes files from the build container's root filesystem during a build step. The path validation for this operation fails to constrain the target within the container rootfs. A crafted LLB message can supply a path that resolves to the host /tmp directory, and BuildKit executes the removal against that host path.
The issue is scoped to the contents of /tmp rather than arbitrary host locations, which bounds the direct impact. However, many system components rely on /tmp for socket files, lock files, and cached artifacts. Deleting these entries can cause application crashes, session loss, or denial of service for co-resident workloads. The Common Weakness Enumeration classification is [CWE-22], improper limitation of a pathname to a restricted directory.
Root Cause
The root cause is insufficient path normalization and containment when the file removal action processes attacker-controlled path arguments in the LLB request. The build action treats the supplied path as trusted relative to the container rootfs, but the underlying implementation follows the path into the host mount namespace and operates on host files.
Attack Vector
Exploitation requires an attacker to submit a crafted LLB build request to a vulnerable BuildKit daemon. The attack vector is local and requires user interaction, since a user must initiate or accept the malicious build. Once triggered, the daemon removes contents from the host /tmp on behalf of the build. Full technical details are available in the GitHub Security Advisory GHSA-32pv-7hq5-qhwq.
Detection Methods for CVE-2026-15791
Indicators of Compromise
- Unexpected deletion of files or sockets under the host /tmp directory during or shortly after a BuildKit build
- BuildKit daemon log entries referencing file removal actions with paths that resolve outside the build rootfs
- Application failures caused by missing lock files, Unix domain sockets, or cached state in /tmp
Detection Strategies
- Audit BuildKit daemon logs for LLB rm or file removal operations that reference /tmp or paths containing traversal sequences
- Monitor filesystem activity on the host /tmp directory for deletions originating from the BuildKit daemon process
- Correlate build job initiation with subsequent unexpected file removals on the host outside build workspaces
Monitoring Recommendations
- Enable auditd or eBPF-based file deletion telemetry on /tmp and record the responsible process, user, and command line
- Track BuildKit versions across build infrastructure and alert on hosts running versions predating the fix referenced in the advisory
- Review build submission sources and flag builds originating from untrusted or unauthenticated clients
How to Mitigate CVE-2026-15791
Immediate Actions Required
- Upgrade Moby BuildKit to the fixed version identified in the GitHub Security Advisory GHSA-32pv-7hq5-qhwq
- Restrict access to the BuildKit daemon socket and API to trusted users and CI systems only
- Review recent build definitions from untrusted sources for suspicious file removal operations targeting /tmp
Patch Information
The Moby project has published a fix through the BuildKit repository. Consult the GitHub Security Advisory for the exact fixed version and upgrade guidance. Downstream distributions of Docker, Buildx, and container build tooling should pull the updated BuildKit release.
Workarounds
- Avoid executing untrusted BuildKit LLB build definitions on hosts running vulnerable versions
- Run BuildKit inside an isolated virtual machine or rootless environment so that any host /tmp accessed by the daemon is not shared with production services
- Limit BuildKit daemon access to authenticated CI pipelines and disable exposure of the daemon API to general users
# Check the installed BuildKit version and upgrade
buildctl --version
# Then upgrade to the fixed release per the advisory before resuming untrusted builds
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

