BuildKit possible race condition with accessing subpaths from cache mounts
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2024-23651
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 10:53 UTC · Revision 1
Source evidence
BuildKit possible race condition with accessing subpaths from cache mounts
core-osv · Original sourcePublished 31 Jan 2024, 21:49 UTC
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.
osv:CVE-2024-23651
Complete source record
{
"id": "cf9ee8f543372b6ab4f6e9ca4989059e293fc172ae1bf11779ba398488825894",
"url": "https://osv.dev/vulnerability/CVE-2024-23651",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "BuildKit possible race condition with accessing subpaths from cache mounts",
"summary": "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.",
"evidence": "osv:CVE-2024-23651",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2024-23651",
"aliases": [
"CVE-2024-23651",
"GHSA-m3r6-h7wv-7xxv",
"GO-2024-2493"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/moby/buildkit",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "bac3f2b673f3f9d33e79046008e7a38e856b3dc6"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.12.5"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "bac3f2b673f3f9d33e79046008e7a38e856b3dc6"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v0.12.5"
},
{
"cpe": "cpe:2.3:a:mobyproject:buildkit:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "0.12.5"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"v0.12.4",
"v0.12.3",
"v0.12.2",
"v0.12.1",
"v0.12.0",
"dockerfile/1.6.0-labs",
"dockerfile/1.6.0",
"v0.12.0-rc2",
"dockerfile/1.6.0-rc2-labs",
"dockerfile/1.6.0-rc2",
"v0.12.0-rc1",
"dockerfile/1.6.0-rc1-labs",
"dockerfile/1.6.0-rc1",
"v0.11.0-rc3",
"v0.11.0-rc2",
"dockerfile/1.5.0-rc2-labs",
"dockerfile/1.5.0-rc2",
"v0.11.0-rc1",
"dockerfile/1.5.0-rc1-labs",
"dockerfile/1.5.0-rc1",
"v0.10.0",
"dockerfile/1.4.0-labs",
"dockerfile/1.4.0",
"v0.10.0-rc2",
"dockerfile/1.4.0-rc2",
"dockerfile/1.4.0-labs-rc2",
"v0.10.0-rc1",
"dockerfile/1.4.0-rc1",
"dockerfile/1.4.0-labs-rc1",
"v0.9.0-rc2",
"v0.9.0",
"dockerfile/1.3.0-labs",
"dockerfile/1.3.0",
"v0.9.0-rc1",
"dockerfile/1.3.0-rc1-labs",
"dockerfile/1.3.0-rc1",
"v0.8.1",
"dockerfile/1.2.1-labs",
"dockerfile/1.2.1",
"dockerfile/1.2.0-labs",
"dockerfile/1.2.0",
"v0.8.0",
"v0.8.0-rc3",
"v0.8.0-rc2",
"v0.8.0-rc1",
"dockerfile/1.2.0-rc1-labs",
"dockerfile/1.2.0-rc1",
"v0.7.0",
"dockerfile/1.1.6-experimental",
"dockerfile/1.1.6",
"v0.7.0-rc1",
"dockerfile/1.1.6-rc1-experimental",
"dockerfile/1.1.6-rc1",
"v0.6.1",
"dockerfile/1.1.3-experimental",
"dockerfile/1.1.3",
"v0.6.0",
"dockerfile/1.1.2-experimental",
"dockerfile/1.1.2",
"dockerfile/1.1.1-experimental",
"dockerfile/1.1.1",
"v0.5.1",
"v0.5.0",
"dockerfile/1.1.0-experimental",
"dockerfile/1.1.0",
"v0.4.0",
"dockerfile/1.0.2-experimental",
"v0.3.3",
"dockerfile/1.0.1-experimental",
"dockerfile/1.0.1",
"dockerfile/1.0.0-experimental",
"dockerfile/1.0.0",
"v0.3.2",
"dockerfile/0.9.0-experimental",
"dockerfile/0.9.0",
"v0.3.1",
"v0.3.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-23651.json"
}
}
],
"modified": "2026-10-28T02:30:28.166578816Z",
"provider": "osv",
"references": [
"https://github.com/moby/buildkit/releases/tag/v0.12.5",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/23xxx/CVE-2024-23651.json",
"https://github.com/moby/buildkit/security/advisories/GHSA-m3r6-h7wv-7xxv",
"https://nvd.nist.gov/vuln/detail/CVE-2024-23651",
"https://github.com/moby/buildkit/pull/4604"
],
"provider_metadata": {
"cwe_ids": [
"CWE-362"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/23xxx/CVE-2024-23651.json"
}
},
"related_cves": [
{
"value": "CVE-2024-23651",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 494715,
"published_at": "2024-01-31T21:49:18.041+00:00"
}