# CVE-2024-23653: BuildKit interactive containers API does not validate entitlements check


- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 31 Jan 2024
- **Updated:** 23 Aug 2024
- **Also known as:** AZL-34078, AZL-34079, AZL-34081, AZL-34084, AZL-34998, AZL-35433, AZL-35439, BELL-CVE-2024-23653, CLEANSTART-2025-HP29789, CLEANSTART-2026-XQ25414, GHSA-wr6v-9f75-vh2g, GO-2024-2497, UBUNTU-CVE-2024-23653, openSUSE-SU-2024:13688-1, openSUSE-SU-2024:14571-1

## What is CVE-2024-23653?

CVE-2024-23653 is a critical vulnerability in moby buildkit, published on 31 Jan 2024. 

### Official description

BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. In addition to running containers as build steps, BuildKit also provides APIs for running interactive containers based on built images. It was possible to use these APIs to ask BuildKit to run a container with elevated privileges. Normally, running such containers is only allowed if special `security.insecure` entitlement is enabled both by buildkitd configuration and allowed by the user initializing the build request. The issue has been fixed in v0.12.5 . Avoid using BuildKit frontends from untrusted sources.

Weakness: CWE-863 (Incorrect Authorization)

## Which versions are affected by CVE-2024-23653?

3 open source packages ship an affected version, including github.com/moby/buildkit. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/moby/buildkit` | Go | All versions | 0.12.5 |
| `github.com/moby/buildkit` | Go | All versions | 0.12.5 |
| `github.com/moby/buildkit` | Go | All versions | 0.12.5 |
| `buildkit` | openSUSE:Tumbleweed | All versions | 0.12.5-2.1 |
| `docker-stable` | openSUSE:Tumbleweed | All versions | 24.0.9_ce-4.1 |

Products: Mobyproject Buildkit.

## How do I fix CVE-2024-23653?

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

## Is CVE-2024-23653 being exploited?

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

Public exploit code:

- https://github.com/666asd/CVE-2024-23653 (github_poc): https://github.com/666asd/CVE-2024-23653

## Other vulnerabilities in moby buildkit

- [CVE-2024-23652](https://insights.sbomify.com/CVE-2024-23652/): BuildKit possible host system access from mount stub cleaner (critical 10.0)
- [CVE-2024-23651](https://insights.sbomify.com/CVE-2024-23651/): BuildKit possible race condition with accessing subpaths from cache mounts (high 8.7)
- [CVE-2026-33747](https://insights.sbomify.com/CVE-2026-33747/): BuildKit vulnerable to malicious frontend causing file escape outside of storage root (high 8.4)
- [CVE-2026-33748](https://insights.sbomify.com/CVE-2026-33748/): BuildKit Git URL subdir component can cause access to restricted files (high 8.2)
- [CVE-2026-15789](https://insights.sbomify.com/CVE-2026-15789/): Malicious client can bypass destination directory validation on local sources upload (medium 6.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-23653 and fix it if it is affected.

What it is: CVE-2024-23653 is a critical vulnerability in moby buildkit, published on 31 Jan 2024. 
Exploitation: There is no known exploitation of CVE-2024-23653 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/moby/buildkit (Go): affected all versions; fixed in 0.12.5
- github.com/moby/buildkit (Go): affected all versions; fixed in 0.12.5
- github.com/moby/buildkit (Go): affected all versions; fixed in 0.12.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-23653/ (Markdown: https://insights.sbomify.com/CVE-2024-23653/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-23653
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-23653
- OSV: https://osv.dev/vulnerability/CVE-2024-23653

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-23653/
Summaries are generated and may contain mistakes; the official description above is the record.
