# CVE-2024-24557: Moby classic builder cache poisoning

> Attackers can poison the classic builder cache to inject malicious code into container builds, affecting users who disable BuildKit or use older versions.

- **Severity:** Medium 6.9 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 1 Feb 2024
- **Updated:** 15 May 2025
- **Also known as:** AZL-34275, AZL-35002, BELL-CVE-2024-24557, CLEANSTART-2026-HP60657, CLEANSTART-2026-PY60272, CLEANSTART-2026-QF32596, CLEANSTART-2026-SP18128, DEBIAN-CVE-2024-24557, GHSA-xw73-rw38-6vjc, GO-2024-2512, MINI-4jx8-mv5m-v9m8, MINI-8364-vw6j-x6hv, MINI-8mgr-xxmc-q436, OESA-2024-1302, UBUNTU-CVE-2024-24557, openSUSE-SU-2024:14287-1

## What is CVE-2024-24557?

CVE-2024-24557 is a medium-severity vulnerability in moby, published on 1 Feb 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Moby is an open-source project created by Docker to enable software containerization. The classic builder cache system is prone to cache poisoning if the image is built FROM scratch. Also, changes to some instructions (most important being HEALTHCHECK and ONBUILD) would not cause a cache miss. An attacker with the knowledge of the Dockerfile someone is using could poison their cache by making them pull a specially crafted image that would be considered as a valid cache candidate for some build steps. 23.0+ users are only affected if they explicitly opted out of Buildkit (DOCKER_BUILDKIT=0 environment variable) or are using the /build API endpoint. All users on versions older than 23.0 could be impacted. Image build API endpoint (/build) and ImageBuild function from github.com/docker/docker/client is also affected as it the uses classic builder by default. Patches are included in 24.0.9 and 25.0.2 releases.

Weakness: CWE-346 (Origin Validation Error), CWE-345 (Insufficient Verification of Data Authenticity)

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

10 open source packages ship an affected version, including github.com/moby/moby and github.com/docker/docker. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/moby/moby` | Go | All versions | 24.0.9+incompatible, 25.0.2+incompatible |
| `github.com/moby/moby` | Go | All versions | 24.0.9 |
| `github.com/moby/moby` | Go | All versions | 24.0.9 |
| `github.com/moby/moby` | Go | From 25.0.0 | 25.0.2 |
| `github.com/moby/moby` | Go | From 25.0.0 | 25.0.2 |
| `github.com/docker/docker` | Go | All versions | 24.0.9+incompatible, 25.0.2+incompatible |
| `github.com/docker/docker` | Go | All versions | 24.0.9 |
| `github.com/docker/docker` | Go | All versions | 24.0.9 |
| `github.com/docker/docker` | Go | From 25.0.0 | 25.0.2 |
| `github.com/docker/docker` | Go | From 25.0.0 | 25.0.2 |
| `forgejo-runner` | openSUSE:Tumbleweed | All versions | 3.5.1-1.1 |

Products: Mobyproject Moby.

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

Upgrade github.com/moby/moby to a fixed version for your release line: 24.0.9+incompatible, 25.0.2+incompatible, 24.0.9 or 25.0.2.

## Is CVE-2024-24557 being exploited?

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

## Other vulnerabilities in moby

- [CVE-2024-36623](https://insights.sbomify.com/CVE-2024-36623/): Moby Race Condition vulnerability (high 8.1)
- [CVE-2023-28840](https://insights.sbomify.com/CVE-2023-28840/): moby/moby's dockerd daemon encrypted overlay network may be unauthenticated (high 7.5)
- [CVE-2018-12608](https://insights.sbomify.com/CVE-2018-12608/): Docker Authentication Bypass (high 7.5)
- [CVE-2023-28841](https://insights.sbomify.com/CVE-2023-28841/): moby/moby's dockerd daemon encrypted overlay network traffic may be unencrypted (medium 6.8)
- [CVE-2023-28842](https://insights.sbomify.com/CVE-2023-28842/): moby/moby's dockerd daemon encrypted overlay network with a single endpoint is unauthenticated (medium 6.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2024-24557 is a medium-severity vulnerability in moby, published on 1 Feb 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-24557 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/moby/moby (Go): affected all versions; fixed in 24.0.9+incompatible, 25.0.2+incompatible
- github.com/moby/moby (Go): affected all versions; fixed in 24.0.9
- github.com/moby/moby (Go): affected all versions; fixed in 24.0.9
- github.com/moby/moby (Go): affected from 25.0.0; fixed in 25.0.2
- github.com/moby/moby (Go): affected from 25.0.0; fixed in 25.0.2
- github.com/docker/docker (Go): affected all versions; fixed in 24.0.9+incompatible, 25.0.2+incompatible
- github.com/docker/docker (Go): affected all versions; fixed in 24.0.9
- github.com/docker/docker (Go): affected all versions; fixed in 24.0.9
- github.com/docker/docker (Go): affected from 25.0.0; fixed in 25.0.2
- github.com/docker/docker (Go): affected from 25.0.0; fixed in 25.0.2

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-24557/ (Markdown: https://insights.sbomify.com/CVE-2024-24557/index.md)
```

## Sources

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

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