CVE-2024-24557: Moby classic builder cache poisoning

Published Feb 1, 2024
·
Updated

Moby could provide weaker than expected security, caused by improper cache validation in the classic builder cache system. By persuading a victim to open a specially crafted file, a remote attacker could exploit this vulnerability to conduct a cache poisoning attack.

Other sources

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 (DOCKERBUILDKIT=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.

NVD

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 (DOCKERBUILDKIT=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 (DOCKERBUILDKIT=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.

GitHub

Affected Software

8 affected componentsFixes available
go/github.com/moby/moby>=25.0.0<25.0.2
25.0.2
go/github.com/moby/moby<24.0.9
24.0.9
go/github.com/docker/docker<24.0.9
24.0.9
go/github.com/docker/docker>=25.0.0<25.0.2
25.0.2
Mobyproject Moby<24.0.9
Mobyproject Moby>=25.0.0<25.0.2
redhat/moby<25.0.2
25.0.2
redhat/moby<24.0.9
24.0.9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/moby/moby to a version that resolves this vulnerability.

    Fixed in 25.0.2
  2. Upgrade

    Upgrade go/github.com/moby/moby to a version that resolves this vulnerability.

    Fixed in 24.0.9
  3. Upgrade

    Upgrade go/github.com/docker/docker to a version that resolves this vulnerability.

    Fixed in 24.0.9
  4. Upgrade

    Upgrade go/github.com/docker/docker to a version that resolves this vulnerability.

    Fixed in 25.0.2
  5. Upgrade

    Upgrade redhat/moby to a version that resolves this vulnerability.

    Fixed in 25.0.2
  6. Upgrade

    Upgrade redhat/moby to a version that resolves this vulnerability.

    Fixed in 24.0.9
  7. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 23.0.10
  8. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 24.0.9
  9. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 25.0.2
  10. Configuration

    Ensure Buildkit is used for Docker builds (do not set DOCKER_BUILDKIT=0). This addresses classic builder cache poisoning exposed via the /build API endpoint (classic builder by default) and ImageBuild calls that use the classic builder.

    Docker image build (classic builder via /build API or ImageBuild) BuildKit = DOCKER_BUILDKIT=1 (and ensure buildx plugin is installed)
  11. Configuration

    If Buildkit cannot be used, disable build caching by using '--no-cache' or setting 'NoCache = true' in ImageBuildOptions for the ImageBuild call.

    Docker image build Cache usage = --no-cache or NoCache=true
  12. Configuration

    Use 'Version = types.BuilderBuildKit' in ImageBuildOptions for the ImageBuild call to avoid the classic builder and its cache poisoning risk.

    Docker image build (github.com/docker/docker/client ImageBuild) ImageBuildOptions.BuilderBuildKit = types.BuilderBuildKit

Event History

Feb 1, 2024
CVE Published
via MITRE·04:26 PM
Data Sourced
via MITRE·04:26 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·08:51 PM
Feb 2, 2024
Data Sourced
via Red Hat·01:00 AM
DescriptionSeverityAffected Software
Feb 4, 2025
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-24557?

CVE-2024-24557 is classified based on its potential impact on system integrity and security.

2

How do I fix CVE-2024-24557?

To mitigate CVE-2024-24557, upgrade to Moby version 25.0.2 or 24.0.9 as soon as possible.

3

What are the affected versions for CVE-2024-24557?

CVE-2024-24557 affects Moby versions prior to 25.0.2 and Docker versions prior to 24.0.9.

4

What types of vulnerabilities does CVE-2024-24557 involve?

CVE-2024-24557 involves cache poisoning and issues with certain Dockerfile instructions like HEALTHCHECK and ONBUILD.

5

Is CVE-2024-24557 specific to certain software?

Yes, CVE-2024-24557 specifically impacts the Moby and Docker software containerization projects.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203