CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2024-23653
9.810.30%

CVE-2024-23653: Build-Time Container Escape in Moby BuildKit via GRPC API Authorization Bypass

Alon Barad
Alon Barad
Software Engineer

Apr 10, 2026·5 min read·2 visits

PoC Available

Executive Summary (TL;DR)

A missing authorization check in BuildKit's GRPC Gateway API allows malicious custom frontends to spawn highly privileged containers during the build process, enabling host root code execution.

Moby BuildKit versions prior to 0.12.5 contain a critical authorization bypass vulnerability (CWE-863) within the interactive containers GRPC Gateway API. A maliciously crafted Dockerfile using a custom frontend can bypass entitlement checks to launch a privileged container, resulting in a build-time escape and full host root command execution.

Vulnerability Overview

Moby BuildKit utilizes a modular architecture where custom frontends parse various input formats into Low-Level Builder (LLB) representations. Developers specify these frontends in Dockerfiles using the # syntax= directive. The frontends execute as ephemeral containers during the build process.

These frontend containers communicate with the primary buildkitd daemon via a GRPC-based Gateway API. This API handles operations such as resolving image metadata, executing build steps, and spawning interactive containers. The gateway exposes endpoints like Container.Start and NewContainer to facilitate dynamic build features.

CVE-2024-23653 is an incorrect authorization vulnerability (CWE-863) within this GRPC Gateway API. BuildKit versions prior to 0.12.5 fail to enforce security entitlement checks when processing dynamic container requests from custom frontends. This failure allows an unprivileged build process to spawn containers with elevated system capabilities.

Root Cause Analysis

The vulnerability originates from a structural disconnect between standard static build execution and the dynamic interactive container API. Standard BuildKit execution rigorously validates privileged operations. Specifically, users must supply the --allow security.insecure flag to permit containers with elevated capabilities.

However, the interactive container API bypasses this validation logic entirely. When a custom frontend interacts with the Gateway API, it constructs a GRPC request detailing the container specifications. The frontend can populate fields such as StartRequest.SecurityMode with the INSECURE enum value or set NetMode to HOST.

Because the buildkitd daemon processes these API requests without invoking the standard entitlement verification layer, it honors the frontend's specifications blindly. The daemon provisions the container according to the requested insecure parameters, granting the frontend container full Linux capabilities irrespective of the user's explicit entitlements.

Code Analysis

The remediation strategy required architectural changes across two primary commits to enforce entitlement validation. Commit 5026d95aa3336e97cfe46e3764f52d08bac7a10e introduced privilege separation by decoupling the execution worker from the frontend Gateway. The Gateway now receives a constrained executor.Executor instance rather than a raw object with excessive internal access.

Commit 92cc595cfb12891d4b3ae476e067c74250e4b71e implemented the explicit authorization checks missing from the interactive container API. The developers introduced a validateEntitlements method within the llbBridge component. This method evaluates the requested ProcessInfo against the build's globally loaded entitlements.

func (b *llbBridge) validateEntitlements(p executor.ProcessInfo) error {
	ent, err := loadEntitlements(b.builder)
	if err != nil {
		return err
	}
	v := entitlements.Values{
		NetworkHost:      p.Meta.NetMode == pb.NetMode_HOST,
		SecurityInsecure: p.Meta.SecurityMode == pb.SecurityMode_INSECURE,
	}
	return ent.Check(v)
}

This validation logic now executes deterministically within the Run and Exec paths of the llbBridge. By intercepting the process request before the container is spawned, the daemon ensures that any dynamic process requested via the Gateway API adheres strictly to the explicit allowlist flags provided during the build invocation.

Exploitation

Exploiting CVE-2024-23653 requires the attacker to construct a malicious Docker image that functions as a BuildKit frontend. This image contains custom GRPC client logic programmed to invoke the NewContainer API endpoint. The request payload explicitly sets SecurityMode to INSECURE.

The attacker then distributes a Dockerfile that references this malicious frontend using the # syntax= directive. When the victim executes a docker build command against this Dockerfile, the BuildKit daemon pulls the malicious frontend image and executes it to parse the build instructions.

During this parsing phase, the frontend image dispatches the malicious GRPC request back to the buildkitd daemon. The daemon spawns the secondary container with elevated privileges. The attacker's code inside this container inherits capabilities such as CAP_SYS_ADMIN, enabling an immediate escape to the underlying host filesystem.

Impact Assessment

The impact of this vulnerability is critical, resulting in arbitrary host root code execution. A successful exploit grants the attacker total control over the build environment. This includes complete read and write access to the host filesystem, the ability to intercept credentials stored in the build context, and pivoting capabilities into the internal network.

The CVSS v3.1 vector evaluates to 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). The network attack vector is fulfilled when build systems automatically ingest and build Dockerfiles from remote repositories or pull external images as build dependencies.

Continuous Integration and Continuous Deployment (CI/CD) pipelines are primarily at risk. Build nodes frequently run with substantial IAM permissions or internal network access. A single compromised build node allows an attacker to manipulate build artifacts, access repository secrets, and establish persistent backdoors in the software supply chain.

Remediation

The primary mitigation is upgrading Moby BuildKit to version 0.12.5 or later. Administrators must also deploy corresponding updates to integrated platforms, including Docker Engine, Docker Desktop, Podman, and Buildah, to ensure the patched buildkitd binary propagates throughout the environment.

Organizations unable to patch immediately should implement strict controls over Dockerfile syntax directives. Build environments must prohibit the execution of untrusted or unverified frontend images. Implementing Open Policy Agent (OPA) Gatekeeper or similar policy engines can enforce restrictions on allowed # syntax targets.

Detection engineering teams can deploy static and runtime analysis tools to identify exploitation attempts. Static analysis utilities can flag suspicious syntax directives referencing untrusted repositories. Runtime eBPF monitoring can identify anomalous GRPC requests targeting the Container.Start endpoint with insecure configurations.

Official Patches

MobyBuildKit Security Advisory (GHSA-wr6v-9f75-vh2g)
DockerDocker Security Advisory: Multiple Vulnerabilities in runc, BuildKit, and Moby

Fix Analysis (2)

Technical Appendix

CVSS Score
9.8/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
10.30%
Top 7% most exploited

Affected Systems

Moby BuildKitDocker EngineDocker DesktopContainer CI/CD Pipelines

Affected Versions Detail

Product
Affected Versions
Fixed Version
Moby BuildKit
Moby
< 0.12.50.12.5
AttributeDetail
CWE IDCWE-863 (Incorrect Authorization)
Attack VectorNetwork
CVSS Score9.8
EPSS Score10.30%
ImpactBuild-Time Container Escape / RCE
Exploit StatusPoC Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1611Escape to Host
Privilege Escalation
CWE-863
Incorrect Authorization

The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.

Vulnerability Timeline

Initial fix commits developed in the moby/buildkit repository
2023-12-12
Vulnerability publicly disclosed by Snyk (part of Leaky Vessels suite)
2024-01-31
CVE-2024-23653 assigned and BuildKit v0.12.5 released
2024-01-31
Major container platform vendors published critical advisories
2024-02-01

References & Sources

  • [1]BuildKit Security Advisory (GHSA-wr6v-9f75-vh2g)
  • [2]Snyk Technical Analysis
  • [3]Wiz Blog: Leaky Vessels Deep Dive
  • [4]BuildKit v0.12.5 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.