Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Classic builder cache poisoning origin validation #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lamcodeofpwnosec
Copy link

@lamcodeofpwnosec lamcodeofpwnosec commented Nov 1, 2024

Required checklist

  • Sample config files updated (both /etc folder and NewDemoConfig methods) (influxdb and plutonium)
  • openapi swagger.yml updated (if modified API) - link openapi PR
  • Signed CLA (if not already signed)

Description

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.

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.

CVE-2024-24557
CWE-345
CWE-346

Note for reviewers:

Check the semantic commit type:

  • Feat: a feature with user-visible changes
  • Fix: a bug fix that we might tell a user “upgrade to get this fix for your issue”
  • Chore: version bumps, internal doc (e.g. README) changes, code comment updates, code formatting fixes… must not be user facing (except dependency version changes)
  • Build: build script changes, CI config changes, build tool updates
  • Refactor: non-user-visible refactoring
  • Check the PR title: we should be able to put this as a one-liner in the release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant