CVE-2024-23651
Docker vulnerability analysis and mitigation

Overview

CVE-2024-23651 is a high-severity vulnerability (CVSS score: 8.7) discovered in BuildKit, a toolkit for converting source code to build artifacts. The vulnerability affects all versions of BuildKit <=v0.12.4 and was disclosed in January 2024. The issue stems from a time-of-check/time-of-use (TOCTOU) race condition when mounting a cache volume at container build time (Snyk Blog, NVD).

Technical details

The vulnerability occurs due to a race condition in the RUN --mount=type=cache directive in a Dockerfile, which allows for mounting persistent directories during Docker image build. When specifying a source path inside the identified cache mount, the validation of this source path introduces a race condition. A concurrent build step with the target cache directory mounted can replace the source path with a symbolic link between the check and use, causing the mount syscall to incorrectly mount an arbitrary directory into the container filesystem (Snyk Blog).

Impact

If successfully exploited, this vulnerability allows an attacker to gain unauthorized access to the underlying host operating system from within the container. The executing process inside the container can observe that the intended cache filesystem mount path contains a bind mount of the host root filesystem. With default access privileges typically set to root user, attackers can escalate from disk access to achieve full host root command execution (Snyk Blog, Hacker News).

Mitigation and workarounds

The vulnerability has been patched in BuildKit version v0.12.5. Users should update to this version or later. For those unable to update immediately, workarounds include avoiding the use of BuildKit frontend from untrusted sources and not building untrusted Dockerfiles containing cache mounts with --mount=type=cache,source=... options (GitHub Advisory, BuildKit Release).

Community reactions

Major cloud providers including AWS, Google Cloud, and Ubuntu have released alerts urging customers to take appropriate action. Docker has acknowledged that the vulnerability can only be exploited if a user actively engages with malicious content by incorporating it into the build process or running a container from a rogue image (Hacker News).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management