CVE-2024-23652
Critical · 9.1CVSS
9.1
EPSS
2.5%
Published
Jan 31, 2024
CISA due date
—
Cloudanix analysis
A bug in a build tool can let a specially crafted build instruction delete important files on the computer running the build instead of only inside the temporary build area.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Tampering
- Component
- Library
- Class
- Path Traversal
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Path traversal flaw in BuildKit's RUN --mount handling allows a malicious frontend or Dockerfile to cause deletion of arbitrary files on the host filesystem outside the build container by tricking the empty file removal logic for mountpoints.
Why it matters to the business
Attackers can cause data loss, configuration corruption, or service disruption on build hosts that process untrusted Dockerfiles or frontends, potentially halting CI/CD pipelines and requiring recovery from backups.
How an attack unfolds
An attacker crafts a malicious Dockerfile or BuildKit frontend containing a specially formed RUN --mount directive. When BuildKit processes the build on a vulnerable host, the mountpoint cleanup logic follows a manipulated path and deletes a chosen file from the host system instead of only inside the container.
How to fix it
Upgrade moby/buildkit to the commit bac3f2b673f3f9d33e79046008e7a38e856b3dc6 or later release v0.12.5. As a workaround, refuse builds that use untrusted frontends or Dockerfiles containing the RUN --mount feature.
How to confirm the fix worked
Verify the installed BuildKit binary or source reports version 0.12.5 or newer containing commit bac3f2b673f3f9d33e79046008e7a38e856b3dc6. Re-run representative builds with RUN --mount directives and confirm no host files outside the container are affected.
Typical attack path
- Obtain or create a malicious BuildKit frontend or Dockerfile that abuses RUN --mount
- Submit the artifact to a BuildKit instance running on a target host
- Trigger the build so the mountpoint removal code executes the crafted path
- Observe or confirm deletion of the targeted host file outside the container
How to detect it
Inspect BuildKit build logs for RUN --mount operations that reference paths outside expected container boundaries and correlate with subsequent host filesystem deletion events in system audit logs.
What your security team should do
- Immediately update all BuildKit deployments to the fixed commit or v0.12.5
- Implement policy to block builds from untrusted frontends or Dockerfiles using RUN --mount until patched
- Monitor build logs and host filesystem changes during CI/CD jobs for unexpected file deletions
- Review and restrict access to BuildKit endpoints that accept arbitrary Dockerfiles
The record
BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. A malicious BuildKit frontend or Dockerfile using RUN --mount could trick the feature that removes empty files created for the mountpoints into removing a file outside the container, from the host system. The issue has been fixed in v0.12.5. Workarounds include avoiding using BuildKit frontends from an untrusted source or building an untrusted Dockerfile containing RUN --mount feature.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Go | github.com/moby/buildkit | 0 | 0.12.5 |
| Chainguard | buildctl | 0 | 0.12.5-r0 |
| Chainguard | buildkitd | 0 | 0.12.5-r0 |
| Chainguard | conftest | 0 | 0.49.0-r1 |
| Chainguard | conftest-fips | 0 | 0.48.0-r2 |
| Chainguard | datadog-agent | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-core-integrations | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-core-integrations-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-fakeintake | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-fakeintake-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-jmx | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-jmx-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-oci-compat | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-oci-compat-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-s6-overlay | 0 | 7.50.3-r1 |
| Chainguard | datadog-agent-s6-overlay-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-cluster-agent | 0 | 7.50.3-r1 |
| Chainguard | datadog-cluster-agent-fips | 0 | 7.50.3-r1 |
| Chainguard | datadog-cluster-agent-oci-compat | 0 | 7.50.3-r1 |
| Chainguard | datadog-cluster-agent-oci-compat-fips | 0 | 7.50.3-r1 |
| Chainguard | docker | 0 | 25.0.2-r0 |
| Chainguard | docker-config-mirror-gcr | 0 | 25.0.2-r0 |
| Chainguard | docker-dind | 0 | 25.0.2-r0 |
| Chainguard | docker-dind-compat | 0 | 25.0.2-r0 |
| Chainguard | docker-init | 0 | 25.0.2-r0 |
| Chainguard | docker-modprobe-compat | 0 | 25.0.2-r0 |
| Chainguard | docker-oci-entrypoint | 0 | 25.0.2-r0 |
| Chainguard | docker-rootless | 0 | 25.0.2-r0 |
| Chainguard | dockerd | 0 | 25.0.2-r0 |
| Chainguard | dockerd-oci-entrypoint | 0 | 25.0.2-r0 |
| Chainguard | dockerd-service | 0 | 25.0.2-r0 |
| Chainguard | dogstatsd | 0 | 7.50.3-r1 |
| Chainguard | guac | 0 | 0.4.0-r1 |
| Chainguard | guaccsub | 0 | 0.4.0-r1 |
| Chainguard | guacgql | 0 | 0.4.0-r1 |
| Chainguard | guacingest | 0 | 0.4.0-r1 |
| Chainguard | guacone | 0 | 0.4.0-r1 |
| Chainguard | kaniko | 0 | 1.20.1-r0 |
| Chainguard | kaniko-compat | 0 | 1.20.1-r0 |
| Chainguard | kaniko-warmer | 0 | 1.20.1-r0 |
| Chainguard | kaniko-warmer-compat | 0 | 1.20.1-r0 |
| Chainguard | kubescape | 0 | 3.0.3-r7 |
| Chainguard | scorecard | 0 | 4.13.1-r4 |
| Chainguard | skaffold | 0 | 2.11.0-r0 |
| Chainguard | trivy | 0 | 0.49.0-r1 |
| Chainguard | zot | 0 | 2.0.1-r2 |
| SUSE:Enterprise Storage 7.1 | buildah | 0 | 1.35.4-150300.8.25.1 |
| SUSE:Enterprise Storage 7.1 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Enterprise Storage 7.1 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Enterprise Storage 7.1 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | buildah | 0 | 1.35.4-150300.8.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP5-ESPOS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP5-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Micro 5.1 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Micro 5.1 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Micro 5.2 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Micro 5.2 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Micro 5.3 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Micro 5.3 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Micro 5.4 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Micro 5.4 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Micro 5.5 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Micro 5.5 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Module for Containers 12 | docker | 0 | 24.0.7_ce-98.106.1 |
| SUSE:Linux Enterprise Module for Containers 12 | docker | 0 | 25.0.5_ce-98.112.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP4 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP5 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP5 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP6 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP6 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Module for Containers 15 SP7 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server 12 SP5-LTSS | docker-stable | 0 | 24.0.9_ce-1.20.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | buildah | 0 | 1.35.4-150300.8.25.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server 15 SP5-LTSS | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 | docker-stable | 0 | 24.0.9_ce-1.20.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | buildah | 0 | 1.35.4-150300.8.25.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | docker | 0 | 24.0.7_ce-150000.193.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | docker | 0 | 25.0.6_ce-150000.207.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP5 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| Ubuntu:20.04:LTS | docker.io | 0 | No fix |
| Ubuntu:20.04:LTS | docker.io-app | 0 | No fix |
| Ubuntu:22.04:LTS | docker.io | 0 | No fix |
| Ubuntu:22.04:LTS | docker.io-app | 0 | No fix |
| Ubuntu:22.04:LTS | docker.io-app | 0 | 27.5.1-0ubuntu3~22.04.2 |
| Ubuntu:24.04:LTS | docker.io | 0 | No fix |
| Ubuntu:24.04:LTS | docker.io-app | 0 | No fix |
| Ubuntu:24.04:LTS | docker.io-app | 0 | 27.5.1-0ubuntu3~24.04.2 |
| Ubuntu:24.10 | docker.io | 0 | No fix |
| Ubuntu:24.10 | docker.io-app | 0 | No fix |
| Ubuntu:25.04 | docker.io | 0 | No fix |
| Ubuntu:25.04 | docker.io-app | 0 | No fix |
| Ubuntu:25.10 | docker.io | 0 | No fix |
| Ubuntu:25.10 | docker.io-app | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | docker.io | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | docker.io | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | docker.io | 0 | 20.10.21-0ubuntu1~18.04.3+esm3 |
| Ubuntu:Pro:20.04:LTS | docker.io | 0 | 20.10.21-0ubuntu1~20.04.6+esm2 |
| Ubuntu:Pro:20.04:LTS | docker.io-app | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | docker.io-app | 0 | 26.1.3-0ubuntu1~20.04.1+esm1 |
| Ubuntu:Pro:22.04:LTS | docker.io | 0 | 20.10.21-0ubuntu1~22.04.7+esm2 |
| Ubuntu:Pro:24.04:LTS | docker.io | 0 | 20.10.25+dfsg1-2ubuntu1+esm2 |
| Wolfi | buildctl | 0 | 0.12.5-r0 |
| Wolfi | buildkitd | 0 | 0.12.5-r0 |
| Wolfi | conftest | 0 | 0.49.0-r1 |
| Wolfi | datadog-agent | 0 | 7.50.3-r1 |
| Wolfi | datadog-agent-core-integrations | 0 | 7.50.3-r1 |
| Wolfi | datadog-agent-fakeintake | 0 | 7.50.3-r1 |
| Wolfi | datadog-agent-jmx | 0 | 7.50.3-r1 |
| Wolfi | datadog-agent-oci-compat | 0 | 7.50.3-r1 |
| Wolfi | datadog-agent-s6-overlay | 0 | 7.50.3-r1 |
| Wolfi | datadog-cluster-agent | 0 | 7.50.3-r1 |
| Wolfi | datadog-cluster-agent-oci-compat | 0 | 7.50.3-r1 |
| Wolfi | docker | 0 | 25.0.2-r0 |
| Wolfi | docker-config-mirror-gcr | 0 | 25.0.2-r0 |
| Wolfi | docker-dind | 0 | 25.0.2-r0 |
| Wolfi | docker-dind-compat | 0 | 25.0.2-r0 |
| Wolfi | docker-init | 0 | 25.0.2-r0 |
| Wolfi | docker-modprobe-compat | 0 | 25.0.2-r0 |
| Wolfi | docker-oci-entrypoint | 0 | 25.0.2-r0 |
| Wolfi | docker-rootless | 0 | 25.0.2-r0 |
| Wolfi | dockerd | 0 | 25.0.2-r0 |
| Wolfi | dockerd-oci-entrypoint | 0 | 25.0.2-r0 |
| Wolfi | dockerd-service | 0 | 25.0.2-r0 |
| Wolfi | dogstatsd | 0 | 7.50.3-r1 |
| Wolfi | guac | 0 | 0.4.0-r1 |
| Wolfi | guaccsub | 0 | 0.4.0-r1 |
| Wolfi | guacgql | 0 | 0.4.0-r1 |
| Wolfi | guacingest | 0 | 0.4.0-r1 |
| Wolfi | guacone | 0 | 0.4.0-r1 |
| Wolfi | kaniko | 0 | 1.20.1-r0 |
| Wolfi | kaniko-compat | 0 | 1.20.1-r0 |
| Wolfi | kaniko-warmer | 0 | 1.20.1-r0 |
| Wolfi | kaniko-warmer-compat | 0 | 1.20.1-r0 |
| Wolfi | kubescape | 0 | 3.0.3-r7 |
| Wolfi | scorecard | 0 | 4.13.1-r4 |
| Wolfi | skaffold | 0 | 2.11.0-r0 |
| Wolfi | trivy | 0 | 0.49.0-r1 |
| Wolfi | zot | 0 | 2.0.1-r2 |
| openSUSE:Leap 15.5 | docker | 0 | 24.0.7_ce-150000.193.1 |
| openSUSE:Leap 15.5 | docker | 0 | 25.0.6_ce-150000.207.1 |
| openSUSE:Leap 15.6 | docker | 0 | 25.0.6_ce-150000.207.1 |
| openSUSE:Leap 15.6 | docker-stable | 0 | 24.0.9_ce-150000.1.25.1 |
| openSUSE:Leap Micro 5.3 | docker | 0 | 24.0.7_ce-150000.193.1 |
| openSUSE:Leap Micro 5.4 | docker | 0 | 24.0.7_ce-150000.193.1 |
| openSUSE:Leap Micro 5.5 | docker | 0 | 25.0.6_ce-150000.207.1 |
| openSUSE:Tumbleweed | buildkit | 0 | 0.12.5-1.1 |
| openSUSE:Tumbleweed | docker | 0 | 24.0.7_ce-3.1 |
| openSUSE:Tumbleweed | docker-stable | 0 | 24.0.9_ce-15.1 |
| openSUSE:Tumbleweed | singularity-ce | 0 | 4.1.3-1.1 |
Related vulnerabilities
- CVE-2024-23651 BuildKit is a toolkit for converting source code to build artifacts in an efficient… Also affects github.com/moby/buildkit
- CVE-2024-23653 BuildKit is a toolkit for converting source code to build artifacts in an efficient… Also affects github.com/moby/buildkit
- CVE-2024-23650 BuildKit is a toolkit for converting source code to build artifacts in an efficient… Also affects github.com/moby/buildkit
- CVE-2026-33186 gRPC-Go is the Go language implementation of gRPC. Also affects buildctl
- CVE-2026-24051 OpenTelemetry-Go is the Go implementation of OpenTelemetry. Also affects buildctl
- CVE-2025-67499 The CNI portmap plugin allows containers to emulate opening a host port, forwarding that… Also affects buildctl
- CVE-2025-61729 Within HostnameError.Error(), when constructing an error string, there is no limit to the… Also affects buildctl
- CVE-2025-64329 containerd CRI server: Host memory exhaustion through Attach goroutine leak Also affects buildctl