/

CVE-2026-15791

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in BuildKit Low-Level API

CVE-2026-15791

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Host Filesystem Deletion and Integrity Loss

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A crafted message sent to BuildKit's low-level build API can cause file deletion operations intended for the container root filesystem to affect the host's /tmp directory.

When build actions are allowed to manipulate paths without adequate isolation, an attacker can potentially remove host temporary files and disrupt workloads relying on them.

A crafted message sent to BuildKit's low-level build API can cause file deletion operations intended for the container root filesystem to affect the host's /tmp directory.

When build actions are allowed to manipulate paths without adequate isolation, an attacker can potentially remove host temporary files and disrupt workloads relying on them.

Affected context

This vulnerability occurs in environments using BuildKit's low-level build API to orchestrate filesystem operations inside build containers.

It is relevant where builds are run on hosts that expose container file manipulation actions and where the build engine does not strictly constrain which filesystem paths can be affected.

Systems that rely heavily on /tmp for runtime data, temporary secrets, or inter-process communication are particularly exposed when those paths are not adequately isolated from build operations.

This vulnerability occurs in environments using BuildKit's low-level build API to orchestrate filesystem operations inside build containers.

It is relevant where builds are run on hosts that expose container file manipulation actions and where the build engine does not strictly constrain which filesystem paths can be affected.

Systems that rely heavily on /tmp for runtime data, temporary secrets, or inter-process communication are particularly exposed when those paths are not adequately isolated from build operations.

Exploit preconditions

  • Attack surface: BuildKit low-level build API exposed to callers (e.g., CI systems, orchestrators, custom tooling).
  • Required access: Ability to submit or influence low-level build messages or instructions consumed by BuildKit.
  • Trigger point: Execution of a filesystem-deletion action intended for the container rootfs that is crafted to escape to the host /tmp directory.
  • Why exploitation is possible: The build API allows operations that are insufficiently constrained to the container's filesystem, enabling path semantics or environment handling that reach the host /tmp directory instead of remaining within the container rootfs.
  • Attack surface: BuildKit low-level build API exposed to callers (e.g., CI systems, orchestrators, custom tooling).
  • Required access: Ability to submit or influence low-level build messages or instructions consumed by BuildKit.
  • Trigger point: Execution of a filesystem-deletion action intended for the container rootfs that is crafted to escape to the host /tmp directory.
  • Why exploitation is possible: The build API allows operations that are insufficiently constrained to the container's filesystem, enabling path semantics or environment handling that reach the host /tmp directory instead of remaining within the container rootfs.

Why this happens

The underlying bug class maps to CWE-22: Improper Limitation of a Path to a Restricted Directory (Path Traversal).

BuildKit's low-level API exposes filesystem operations that are expected to be confined to the container root filesystem, but the implementation fails to enforce strict directory boundaries and isolation for certain delete actions.

As a result, a crafted message can cause path resolution or environment handling to target the host /tmp directory, allowing deletion beyond the intended restricted path scope.

The underlying bug class maps to CWE-22: Improper Limitation of a Path to a Restricted Directory (Path Traversal).

BuildKit's low-level API exposes filesystem operations that are expected to be confined to the container root filesystem, but the implementation fails to enforce strict directory boundaries and isolation for certain delete actions.

As a result, a crafted message can cause path resolution or environment handling to target the host /tmp directory, allowing deletion beyond the intended restricted path scope.

Potential impact

  • Deletion of files and directories in the host /tmp path.
  • Disruption of applications and services relying on temporary files for normal operation.
  • Interruption of running builds, CI jobs, or background services that use /tmp for state or IPC.
  • Possible loss of diagnostic logs or temporary security artifacts stored in /tmp.
  • Deletion of files and directories in the host /tmp path.
  • Disruption of applications and services relying on temporary files for normal operation.
  • Interruption of running builds, CI jobs, or background services that use /tmp for state or IPC.
  • Possible loss of diagnostic logs or temporary security artifacts stored in /tmp.

General mitigation guidance

Effective mitigation focuses on tightening filesystem boundaries and reducing trust in build instructions.

Common defensive patterns include:

  • Enforcing strict path confinement so that build actions can only affect directories explicitly scoped to the container rootfs.
  • Implementing robust validation and normalization of paths used in file operations, rejecting any that resolve outside the intended sandbox.
  • Running the build engine with minimized privileges and leveraging dedicated, isolated temporary directories rather than the host-wide /tmp.
  • Treating build definitions and low-level instructions as untrusted input and restricting which filesystem actions are allowed from them.

Effective mitigation focuses on tightening filesystem boundaries and reducing trust in build instructions.

Common defensive patterns include:

  • Enforcing strict path confinement so that build actions can only affect directories explicitly scoped to the container rootfs.
  • Implementing robust validation and normalization of paths used in file operations, rejecting any that resolve outside the intended sandbox.
  • Running the build engine with minimized privileges and leveraging dedicated, isolated temporary directories rather than the host-wide /tmp.
  • Treating build definitions and low-level instructions as untrusted input and restricting which filesystem actions are allowed from them.

How teams detect issues like this

Detection typically involves a combination of runtime monitoring and code-level controls:

  • Monitoring build hosts for unusual or bulk deletions in /tmp correlated with BuildKit activity.
  • Enforcing policies that restrict which low-level build operations are allowed, with logging for any attempts to access host paths.
  • Using static analysis or configuration review to identify unsafe filesystem APIs or path-handling logic in the build orchestration layer.
  • Reviewing CI/CD and automation scripts for direct use of low-level BuildKit actions that manipulate paths without clear sandbox boundaries.

Detection typically involves a combination of runtime monitoring and code-level controls:

  • Monitoring build hosts for unusual or bulk deletions in /tmp correlated with BuildKit activity.
  • Enforcing policies that restrict which low-level build operations are allowed, with logging for any attempts to access host paths.
  • Using static analysis or configuration review to identify unsafe filesystem APIs or path-handling logic in the build orchestration layer.
  • Reviewing CI/CD and automation scripts for direct use of low-level BuildKit actions that manipulate paths without clear sandbox boundaries.

Sources

SourceLink
github.comgithub.com/moby/buildkit/security/advisories/GHSA-32pv-7hq5-qhwq

Frequently asked

questions

No. The issue specifically allows an action meant for the container rootfs to escape and affect the host /tmp directory, leading to host-level file deletion.

An attacker must be able to send or control messages to the BuildKit low-level build API, typically through CI systems, build pipelines, or orchestration tooling that integrates with BuildKit.

The most robust fix is to enforce strict sandboxing of filesystem operations so that build actions are confined to designated directories, combined with strong path validation and privilege minimization for the build engine.

Design build and orchestration systems with clear trust boundaries, apply consistent path normalization and restriction, treat build instructions as untrusted input, and incorporate security review and automated checks for filesystem access patterns in the development and CI lifecycle.

No. The issue specifically allows an action meant for the container rootfs to escape and affect the host /tmp directory, leading to host-level file deletion.

An attacker must be able to send or control messages to the BuildKit low-level build API, typically through CI systems, build pipelines, or orchestration tooling that integrates with BuildKit.

The most robust fix is to enforce strict sandboxing of filesystem operations so that build actions are confined to designated directories, combined with strong path validation and privilege minimization for the build engine.

Design build and orchestration systems with clear trust boundaries, apply consistent path normalization and restriction, treat build instructions as untrusted input, and incorporate security review and automated checks for filesystem access patterns in the development and CI lifecycle.

Find out what's already
exploitable in your codebase.