CVE-2023-26054
JSON

6.5medium

Credentials inlined to Git URLs could end up in provenance attestation in BuildKit

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.03% (higher than 64% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-gc89-7gcr-jxqc

Description

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`.

Affected

Product or packageVersionsReported by
moby buildkit>= 0.10.0, < 0.11.4CVE List
github.com/moby/buildkit (Go)from 0.10.0 before 0.11.4GitHub Advisory Database
mobyproject buildkitfrom 0.10.0 before 0.11.4NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Classification

CWE-200

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

What each source says

CVE List

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`.

GitHub Advisory Database

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
  1. 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 BUILDX_GIT_INFO=0. buildctl does not set VCS hints based on .git directory, and values would need to be passed manually with --opt.

References
NVD (es)

BuildKit es un conjunto de herramientas para convertir código fuente para crear artefactos de manera eficiente, expresiva y repetible. En las versiones afectadas, cuando el usuario envía una solicitud de compilación que contiene una URL de Git que contiene credenciales y la compilación crea una atestación de procedencia que describe esa compilación, estas credenciales podrían ser visibles desde la atestación de procedencia. La URL de Git se puede pasar de dos maneras: 1) Invocando la compilación directamente desde una URL con credenciales. 2) Si el cliente envía parámetros de sugerencias de información del sistema de control de versiones (VCS) adicionales en compilaciones desde una fuente local. Por lo general, eso significaría leer la URL de origen del archivo `.git/config`. Cuando se realiza una compilación en condiciones específicas en las que se pasaron credenciales a BuildKit, es posible que sean visibles para todos los que tengan acceso a la certificación de procedencia. En la versión v0.11.0 se agregaron certificaciones de procedencia y sugerencias de información de VCS. Las versiones anteriores no son vulnerables. En la versión 0.10, al compilar directamente desde la URL de Git, la misma URL podría ser visible en la estructura `BuildInfo` que es una predecesora de las certificaciones de procedencia. Las versiones anteriores no son vulnerables. Este error se ha solucionado en v0.11.4. Se recomienda a los usuarios que actualicen. Los usuarios que no puedan actualizar pueden desactivar las sugerencias de información de VCS configurando `BUILDX_GIT_INFO=0`. `buildctl` no establece sugerencias de VCS basadas en el directorio `.git` y los valores deberían pasarse manualmente con `--opt`.

References

https://github.com/moby/buildkit/security/advisories/GHSA-gc89-7gcr-jxqcexploit, vendor-advisory, web
https://github.com/moby/buildkit/commit/75123c696506bdbca1ed69906479e200f1b62604patch, web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZTE4ITXXPIWZEQ4HYQCB6N6GZIMWXDAI/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LYZOKMMVX4SIEHPJW3SJUQGMO5YZCPHC/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XNF4OLYZRQE75EB5TW5N42FSXHBXGWFE/
https://nvd.nist.gov/vuln/detail/CVE-2023-26054advisory
https://github.com/moby/buildkitpackage
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LYZOKMMVX4SIEHPJW3SJUQGMO5YZCPHCweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XNF4OLYZRQE75EB5TW5N42FSXHBXGWFEweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZTE4ITXXPIWZEQ4HYQCB6N6GZIMWXDAIweb
https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1web

Sources

SourceRecordLicence
CVE ListCVE-2023-26054 changed 2025-02-25CVE Terms of Use
GitHub Advisory DatabaseGHSA-gc89-7gcr-jxqc changed 2023-11-08CC-BY-4.0
NVDCVE-2023-26054 changed 2026-06-17Public domain