CVE-2024-23652 BuildKit possible host system access from mount stub cleaner

Critical 10.0 Published Updated

A malicious Dockerfile or frontend can trick BuildKit into deleting files on the host system, potentially leading to privilege escalation or data loss.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-23652?

CVE-2024-23652 is a critical path traversal vulnerability in moby buildkit, published on 31 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.

Weakness: CWE-22

Which versions are affected by CVE-2024-23652?

3 open source packages ship an affected version, including github.com/moby/buildkit. It affects 1 product.

PackageAffectedFixed in
github.com/moby/buildkit GoAll versions0.12.5
github.com/moby/buildkit GoAll versions0.12.5
github.com/moby/buildkit GoAll versions0.12.5

Products include Mobyproject Buildkit.

How do I fix CVE-2024-23652?

Upgrade github.com/moby/buildkit to 0.12.5 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2024-23652 being exploited?

There is no known exploitation of CVE-2024-23652 in the wild and no public exploit code.

Public exploit code: 2 proofs of concept on GitHub.

Sources

Also known as AZL-34086, AZL-35010, BELL-CVE-2024-23652, CLEANSTART-2025-VO24808, CLEANSTART-2026-LT94285, GHSA-4v98-7qmw-rqr8 and 2 more.

Is CVE-2024-23652 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free