← back
CVE-2024-23651

BuildKit possible race condition with accessing subpaths from cache mounts

CVSS 8.7 HIGHEPSS 0.8%CWE-362
In short

BuildKit can allow files from the host system to be accessed by a build container when two malicious build steps run in parallel sharing the same cache mount with subpaths, due to a race condition. This is a serious security issue because it exposes sensitive host files to untrusted containers.

Technical detail

A race condition exists in BuildKit's cache mount handling when multiple build steps execute concurrently with overlapping subpaths on shared cache mounts. An attacker controlling two parallel build steps can exploit timing gaps during cache access to read arbitrary files from the host filesystem that should be isolated. The vulnerability requires shared cache configuration with subpaths and parallel execution; it was resolved in v0.12.5.

Summary generated and translated by AI from the 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.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Affected products
moby · buildkit

Want to know if your infrastructure is exposed to this?

Talk to TrueHacking →