Headline
CVE-2023-26054: Merge pull request from GHSA-gc89-7gcr-jxqc · moby/buildkit@75123c6
BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. In affected versions when the user sends a build request that contains a Git URL that contains credentials and the build creates a provenance attestation describing that build, these credentials could be visible from the provenance attestation. Git URL can be passed in two ways: 1) Invoking build directly from a URL with credentials. 2) If the client sends additional version control system (VCS) info hint parameters on builds from a local source. Usually, that would mean reading the origin URL from .git/config
file. When a build is performed under specific conditions where credentials were passed to BuildKit they may be visible to everyone who has access to provenance attestation. Provenance attestations and VCS info hints were added in version v0.11.0. Previous versions are not vulnerable. In v0.10, when building directly from Git URL, the same URL could be visible in BuildInfo
structure that is a predecessor of Provenance attestations. Previous versions are not vulnerable. This bug has been fixed in v0.11.4. Users are advised to upgrade. Users unable to upgrade may disable VCS info hints by setting BUILDX_GIT_INFO=0
. buildctl
does not set VCS hints based on .git
directory, and values would need to be passed manually with --opt
.
@@ -77,9 +77,10 @@ RUN echo “ok” > /foo "attest:provenance": provReq, "build-arg:FOO": "bar", "label:lbl": "abc", "vcs:source": "https://example.invalid/repo.git", "vcs:source": "https://user:[email protected]/repo.git", "vcs:revision": "123456", "filename": "Dockerfile", dockerui.DefaultLocalNameContext + ":foo": "https://foo:[email protected]/foo.html", }, Exports: []client.ExportEntry{ { @@ -137,30 +138,32 @@ RUN echo “ok” > /foo require.Equal(t, "gateway.v0", pred.Invocation.Parameters.Frontend)
if mode == “max” || mode == “” { require.Equal(t, 3, len(args), "%v", args) require.Equal(t, 4, len(args), "%v", args) require.True(t, pred.Metadata.Completeness.Parameters)
require.Equal(t, "bar", args[“build-arg:FOO”]) require.Equal(t, "abc", args[“label:lbl”]) require.Contains(t, args[“source”], “buildkit_test/”) } else { require.False(t, pred.Metadata.Completeness.Parameters) require.Equal(t, 1, len(args), "%v", args) require.Equal(t, 2, len(args), "%v", args) require.Contains(t, args[“source”], “buildkit_test/”) } require.Equal(t, "https://xxxxx:[email protected]/foo.html", args[“context:foo”]) } else { require.Equal(t, "dockerfile.v0", pred.Invocation.Parameters.Frontend)
if mode == “max” || mode == “” { require.Equal(t, 2, len(args)) require.Equal(t, 3, len(args)) require.True(t, pred.Metadata.Completeness.Parameters)
require.Equal(t, "bar", args[“build-arg:FOO”]) require.Equal(t, "abc", args[“label:lbl”]) } else { require.False(t, pred.Metadata.Completeness.Parameters) require.Equal(t, 0, len(args), "%v", args) require.Equal(t, 1, len(args), "%v", args) } require.Equal(t, "https://xxxxx:[email protected]/foo.html", args[“context:foo”]) }
expectedBase := “pkg:docker/busybox@latest?platform=” + url.PathEscape(platforms.Format(platforms.Normalize(platforms.DefaultSpec()))) @@ -177,7 +180,7 @@ RUN echo “ok” > /foo
if !isClient { require.Equal(t, "Dockerfile", pred.Invocation.ConfigSource.EntryPoint) require.Equal(t, "https://example.invalid/repo.git", pred.Metadata.BuildKitMetadata.VCS[“source”]) require.Equal(t, "https://xxxxx:[email protected]/repo.git", pred.Metadata.BuildKitMetadata.VCS[“source”]) require.Equal(t, "123456", pred.Metadata.BuildKitMetadata.VCS[“revision”]) }
@@ -265,6 +268,11 @@ COPY myapp.Dockerfile /
target := registry + “/buildkit/testwithprovenance:git”
// inject dummy credentials to test that they are masked expectedURL := strings.Replace(server.URL, "http://", "http://xxxxx:xxxxx@", 1) require.NotEqual(t, expectedURL, server.URL) server.URL = strings.Replace(server.URL, "http://", "http://user:pass@", 1)
_, err = f.Solve(sb.Context(), c, client.SolveOpt{ FrontendAttrs: map[string]string{ "context": server.URL + "/.git#v1", @@ -318,7 +326,7 @@ COPY myapp.Dockerfile / require.Equal(t, "", pred.Invocation.ConfigSource.EntryPoint) } else { require.NotEmpty(t, pred.Invocation.Parameters.Frontend) require.Equal(t, server.URL+"/.git#v1", pred.Invocation.ConfigSource.URI) require.Equal(t, expectedURL+"/.git#v1", pred.Invocation.ConfigSource.URI) require.Equal(t, "myapp.Dockerfile", pred.Invocation.ConfigSource.EntryPoint) }
@@ -332,15 +340,15 @@ COPY myapp.Dockerfile / require.Equal(t, expBase, pred.Materials[1].URI) require.NotEmpty(t, pred.Materials[1].Digest[“sha256”])
require.Equal(t, server.URL+"/.git#v1", pred.Materials[2].URI) require.Equal(t, expectedURL+"/.git#v1", pred.Materials[2].URI) require.Equal(t, strings.TrimSpace(string(expectedGitSHA)), pred.Materials[2].Digest[“sha1”]) } else { require.Equal(t, 2, len(pred.Materials), "%+v", pred.Materials)
require.Equal(t, expBase, pred.Materials[0].URI) require.NotEmpty(t, pred.Materials[0].Digest[“sha256”])
require.Equal(t, server.URL+"/.git#v1", pred.Materials[1].URI) require.Equal(t, expectedURL+"/.git#v1", pred.Materials[1].URI) require.Equal(t, strings.TrimSpace(string(expectedGitSHA)), pred.Materials[1].Digest[“sha1”]) }
Related news
Gentoo Linux Security Advisory 202409-29 - Multiple vulnerabilities have been discovered in Docker, the worst of which could result in denial of service. Versions greater than or equal to 25.0.4 are affected.
Red Hat Security Advisory 2023-5952-01 - An update is now available for Red Hat OpenShift Service Mesh 2.4 for RHEL 8.
Red Hat OpenShift Container Platform release 4.13.3 is now available with updates to packages and images that fix several bugs and add enhancements. This release includes a security update for Red Hat OpenShift Container Platform 4.13. Red Hat Product Security has rated this update as having a security impact of [impact]. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available for each vulnerability from the CVE link(s) in the References section.This content is licensed under the Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/). If you distribute this content, or a modified version of it, you must provide attribution to Red Hat Inc. and provide a link to the original. Related CVEs: * CVE-2022-41723: A flaw was found in golang. A maliciously crafted HTTP/2 stream could cause excessive CPU consumption in the HPACK decoder, sufficient to cause a denial of service from a small number...
When the user sends a build request that contains a Git URL that contains credentials and the build creates a provenance attestation describing that build, these credentials could be visible from the provenance attestation. Git URL can be passed in two ways: 1) Invoking build directly from a URL with credentials. ``` buildctl build --frontend dockerfile.v0 --context https://<credentials>@url/repo.git ``` Equivalent in `docker buildx` would be ``` docker buildx build https://<credentials>@url/repo.git ``` 2) If the client sends additional VCS info hint parameters on builds from a local source. Usually, that would mean reading the origin URL from `.git/config` file. Thanks to Oscar Alberto Tovar for discovering the issue. ### Impact When a build is performed under specific conditions where credentials were passed to BuildKit they may be visible to everyone who has access to provenance attestation. Provenance attestations and VCS info hints were added in version v0.11.0. Previou...