CVE-2023-26054: Credentials inlined to Git URLs could end up in provenance attestation in BuildKit
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 BUILDXGITINFO=0. buildctl does not set VCS hints based on .git directory, and values would need to be passed manually with --opt.
Other sources
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. 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.
Note: Docker Build-push Github action builds from Git URLs by default but is not affected by this issue even when working with private repositories because the credentials are passed with build secrets and not with URLs.
Patches Bug is fixed in v0.11.4 .
Workarounds It is recommended to pass credentials with build secrets when building directly from Git URL as a more secure alternative than modifying the URL.
In Docker Buildx, VCS info hint can be disabled by setting BUILDXGITINFO=0. buildctl does not set VCS hints based on .git directory, and values would need to be passed manually with --opt.
References - Inline credentials in URLs deprecated in RFC3986 https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1
Affected Software
Remediation
Event History
Frequently Asked Questions
What is CVE-2023-26054?
CVE-2023-26054 is a vulnerability that allows credentials passed in Git URLs to be visible in the provenance attestation.
How does CVE-2023-26054 affect BuildKit?
CVE-2023-26054 affects BuildKit by allowing credentials to be exposed in the provenance attestation when a build request contains a Git URL with credentials.
What is the severity of CVE-2023-26054?
CVE-2023-26054 has a severity rating of 6.5 (medium).
How do I fix CVE-2023-26054 on BuildKit?
To fix CVE-2023-26054 on BuildKit, update to version 0.11.4 or higher.
Where can I find more information about CVE-2023-26054?
You can find more information about CVE-2023-26054 at the following references: [GitHub Security Advisory](https://github.com/moby/buildkit/security/advisories/GHSA-gc89-7gcr-jxqc), [NVD](https://nvd.nist.gov/vuln/detail/CVE-2023-26054), [GitHub Commit](https://github.com/moby/buildkit/commit/75123c696506bdbca1ed69906479e200f1b62604).