CVE-2024-24557
JSON

6.9medium

Moby classic builder cache poisoning

Severity
6.9medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.26% (higher than 18% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-xw73-rw38-6vjcGO-2024-2512

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.

Affected

Product or packageVersionsReported by
moby moby>= 25.0.0, < 25.0.2, < 24.0.9CVE List
github.com/docker/docker (Go)before 24.0.9, from 25.0.0 before 25.0.2, before 24.0.9+incompatible, from 25.0.0+incompatible before 25.0.2+incompatibleGitHub Advisory Database, Go Vulnerability Database
github.com/moby/moby (Go)before 24.0.9, from 25.0.0 before 25.0.2, before 24.0.9+incompatible, from 25.0.0+incompatible before 25.0.2+incompatibleGitHub Advisory Database, Go Vulnerability Database
mobyproject mobybefore 24.0.9, from 25.0.0 before 25.0.2NVD

All scores

GitHub_M6.9medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:L
GitHub6.9medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:L
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-345CWE-346

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database

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.

For example, an attacker could create an image that is considered as a valid cache candidate for:

FROM scratch
MAINTAINER Pawel

when in fact the malicious image used as a cache would be an image built from a different Dockerfile.

In the second case, the attacker could for example substitute a different HEALTCHECK command.

Impact

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 (which uses the classic builder by default).

All users on versions older than 23.0 could be impacted. An example could be a CI with a shared cache, or just a regular Docker user pulling a malicious image due to misspelling/typosquatting.

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

Patches are included in Moby releases:

  • v25.0.2
  • v24.0.9
  • v23.0.10
Workarounds
  • Use --no-cache or use Buildkit if possible (DOCKER_BUILDKIT=1, it's default on 23.0+ assuming that the buildx plugin is installed).
  • Use Version = types.BuilderBuildKit or NoCache = true in ImageBuildOptions for ImageBuild call.
Go Vulnerability Database

Classic builder cache poisoning in github.com/docker/docker

NVD (es)

Moby es un proyecto de código abierto creado por Docker para permitir la contenedorización de software. El sistema de caché del constructor clásico es propenso a envenenar el caché si la imagen se crea DESDE scratch. Además, los cambios en algunas instrucciones (las más importantes son HEALTHCHECK y ONBUILD) no provocarían una pérdida de caché. Un atacante con conocimiento del Dockerfile que alguien está usando podría envenenar su caché al obligarlo a extraer una imagen especialmente manipulada que se consideraría como un candidato de caché válido para algunos pasos de compilación. Los usuarios de 23.0+ solo se ven afectados si optaron explícitamente por no participar en Buildkit (variable de entorno DOCKER_BUILDKIT=0) o si están usando el endpoint API /build. Todos los usuarios con versiones anteriores a la 23.0 podrían verse afectados. El punto final de la API de creación de imágenes (/build) y la función ImageBuild de github.com/docker/docker/client también se ven afectados ya que utiliza el generador clásico de forma predeterminada. Los parches se incluyen en las versiones 24.0.9 y 25.0.2.

References

Related

Sources

SourceRecordLicence
CVE ListCVE-2024-24557 changed 2025-05-15CVE Terms of Use
GitHub Advisory DatabaseGHSA-xw73-rw38-6vjc changed 2026-09-10CC-BY-4.0
Go Vulnerability DatabaseGO-2024-2512 changed 2026-02-04CC-BY-4.0
NVDCVE-2024-24557 changed 2026-06-17Public domain