CVE-2024-23651 BuildKit possible race condition with accessing subpaths from cache mounts

High 8.7 Published Updated

A race condition in BuildKit allows malicious parallel build steps to access host system files via shared cache mounts.

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-23651?

CVE-2024-23651 is a high-severity 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. Two malicious build steps running in parallel sharing the same cache mounts with subpaths could cause a race condition that can lead to files from the host system being accessible to the build container. The issue has been fixed in v0.12.5. Workarounds include, avoiding using BuildKit frontend from an untrusted source or building an untrusted Dockerfile containing cache mounts with --mount=type=cache,source=... options.

Weakness: CWE-362

Which versions are affected by CVE-2024-23651?

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-23651?

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

Is CVE-2024-23651 being exploited?

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

Sources

Also known as AZL-34085, AZL-35005, BELL-CVE-2024-23651, CLEANSTART-2025-MU54155, CLEANSTART-2026-HB39475, GHSA-m3r6-h7wv-7xxv and 2 more.

Is CVE-2024-23651 in your software?

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

Check your SBOMs for free