GHSA-vp35-85q5-9f25: Github.com/docker/docker Container Build Can Leak Any Vulnerability

LOW
CWE-200
Published
Advisory Summary

GHSA-vp35-85q5-9f25 is a LOW container build can leak any vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Github.com/docker/docker libraries in the Go ecosystem. The issue involves container build can leak any path on the host into the container. Remediation is available by upgrading affected packages to version 20.10.20.

GHSA-vp35-85q5-9f25 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-vp35-85q5-9f25
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Github.com/docker/docker
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-vp35-85q5-9f25

To remediate this vulnerability, upgrade all affected Github.com/docker/docker dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/docker/docker fixed: 20.10.20
Upgrade github.com/docker/docker to 20.10.20
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/docker/docker

How to Check if You Are Affected

To determine whether your application is affected by GHSA-vp35-85q5-9f25, inspect your project dependencies for Github.com/docker/docker:

inspect dependencies for github.com/docker/docker

Analyze the terminal output to locate any version of Github.com/docker/docker in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 20.10.20), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Github.com/docker/docker, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description Moby is the open source Linux container runtime and set of components used to build a variety of downstream container runtimes, including Docker CE, Mirantis Container Runtime (formerly Docker EE), and Docker Desktop. Moby allows for building container images using a set of build instructions (usually named and referred to as a "Dockerfile"), and a build context, which is not unlike the CWD in which the Dockerfile instructions are executed. Containers may be built using a variety of tools and build backends available in the Moby ecosystem; in all cases, builds may not include files outside of the build context (such as using absolute or relative-parent paths). This is enforced through both checks in the build backends, and the containerization of the build process itself. Versions of Git where CVE-2022-39253 is present and exploited by a malicious repository, when used in combination with Moby, are subject to an unexpected inclusion of arbitrary filesystem paths in the build context, without any visible warning to the user. This issue was originally reported by Wenxiang Qian of Tencent Blade Team, and the root-cause analysis was performed by Cory Snider of Mirantis, with assistance from Bjorn Neergaard of the same. The issue was then reported to the Git project, and Taylor Blau led the process resolving the root issue in Git. ### Impact This vulnerability originates in Git, but can be used to violate assumptions that may have security implications for users of Moby and related components. Users may rely on the fact that a build context ensures that outside files cannot be referenced or incorporated using multiple enforcement mechanisms, or expect a warning if this does not hold true. A maliciously crafted Git repository exploiting CVE-2022-39253 can violate this assumption, and potentially include sensitive files that are subsequently uploaded to a container image repository, or disclosed by code inside the resulting container image. As this issue cannot be triggered remotely, except by users who already have full control over the daemon through the API, and it requires exploiting a vulnerability in Git by convincing a user to build a maliciously crafted repository, the impact in Moby is considered low. ### Patches Moby 20.10.20, and Mirantis Container Runtime (formerly Docker Enterprise Edition) 20.10.14 will contain mitigations for CVE-2022-39253 when a Git clone is performed by Moby components (on either the daemon or API client side). However, as these mitigations only apply to certain scenarios (build of `git+<protocol>://...` URL contexts) and cannot protect against a malicious repository already on disk, users should update to a version of Git containing patches for CVE-2022-39253 on all their systems running both API clients and daemons. Specifically, patches in Moby (including patches incorporated from BuildKit) protect against the following: * `docker build` with the legacy builder (e.g. `DOCKER_BUILDKIT` unset or set to 0) of a Git URL context. Note that depending on available API versions and the CLI version, the Git clone operation can take place on either the client or the daemon side. Both must be updated (or have Git updated) to fully protect this build method. * `docker build` with the BuildKit builder (e.g. `DOCKER_BUILDKIT=1`) of a Git URL context. * `docker buildx build` with `BUILDKIT_CONTEXT_KEEP_GIT_DIR=1` of a Git URL context. Patches in BuildKit incorporated into Docker Compose protect against CVE-2022-39253 during Compose-driven builds of Git URL contexts. Patches in Moby and related projects such as BuildKit, the Docker CLI, and Docker Compose **cannot** fully protect against CVE-2022-39253, as it may be triggered by a malicious repository already on disk that a unpatched Git client has interacted with (specifically, commands that check out submodules such as `git clone --recursive`, `git submodule update`, etc. may have already triggered the Git vulnerability). ### Workarounds While this behavior is unexpected and undesirable, and has resulted in this security advisory, users should keep in mind that building a container entails arbitrary code execution. Users should not build a repository/build context they do not trust, as containerization cannot protect against all possible attacks. When building with BuildKit (e.g. `docker buildx build` or `docker build` with `DOCKER_BUILDKIT=1`), this issue cannot be exploited unless `--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1` was also passed, as by default BuildKit will discard the `.git` directory of a Git URL context immediately after cloning and checking out the repository. ### For more information If you have any questions or comments about this advisory: * [Open an issue](https://github.com/moby/moby/issues/new) * Email us at [security@docker.com](mailto:security@docker.com)

GHSA-vp35-85q5-9f25 Affected Github.com/docker/docker Versions

1 component(s)
Fixed Versions:
20.10.20
Product / Package Ecosystem Affected Versions Fixed Version
github.com/docker/docker
Go
< 20.10.20
20.10.20

References

Frequently Asked Questions

What is GHSA-vp35-85q5-9f25?
GHSA-vp35-85q5-9f25 is a security vulnerability in Github.com/docker/docker involving Container build can leak any path on the host into the container under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Github.com/docker/docker versions are affected?
Affected versions include releases prior to 20.10.20 across affected packages: github.com/docker/docker.
What version fixes GHSA-vp35-85q5-9f25?
Upgrading to 20.10.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/docker/docker affected?
Yes, github.com/docker/docker is affected in releases prior to 20.10.20. Upgrade your dependency to 20.10.20 or later.
What CWE is associated with GHSA-vp35-85q5-9f25?
GHSA-vp35-85q5-9f25 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check Go dependencies for GHSA-vp35-85q5-9f25?
Run the dependency tree command: 'inspect dependencies for github.com/docker/docker'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vp35-85q5-9f25",
  "modified" : "2024-07-08T15:52:59Z",
  "published" : "2022-11-11T00:03:31Z",
  "aliases" : [ ],
  "summary" : "Container build can leak any path on the host into the container",
  "details" : "### Description\n\nMoby is the open source Linux container runtime and set of components used to build a variety of downstream container runtimes, including Docker CE, Mirantis Container Runtime (formerly Docker EE), and Docker Desktop. Moby allows for building container images using a set of build instructions (usually named and referred to as a \"Dockerfile\"), and a build context, which is not unlike the CWD in which the Dockerfile instructions are executed.\n\nContainers may be built using a variety of tools and build backends available in the Moby ecosystem; in all cases, builds may not include files outside of the build context (such as using absolute or relative-parent paths). This is enforced through both checks in the build backends, and the containerization of the build process itself.\n\nVersions of Git where CVE-2022-39253 is present and exploited by a malicious repository, when used in combination with Moby, are subject to an unexpected inclusion of arbitrary filesystem paths in the build context, without any visible warning to the user.\n\nThis issue was originally reported by Wenxiang Qian of Tencent Blade Team, and the root-cause analysis was performed by Cory Snider of Mirantis, with assistance from Bjorn Neergaard of the same. The issue was then reported to the Git project, and Taylor Blau led the process resolving the root issue in Git.\n\n### Impact\n\nThis vulnerability originates in Git, but can be used to violate assumptions that may have security implications for users of Moby and related components. Users may rely on the fact that a build context ensures that outside files cannot be referenced or incorporated using multiple enforcement mechanisms, or expect a warning if this does not hold true. A maliciously crafted Git repository exploiting CVE-2022-39253 can violate this assumption, and potentially include sensitive files that are subsequently uploaded to a container image repository, or disclosed by code inside the resulting container image.\n\nAs this issue cannot be triggered remotely, except by users who already have full control over the daemon through the API, and it requires exploiting a vulnerability in Git by convincing a user to build a maliciously crafted repository, the impact in Moby is considered low.\n\n### Patches\n\nMoby 20.10.20, and Mirantis Container Runtime (formerly Docker Enterprise Edition) 20.10.14 will contain mitigations for CVE-2022-39253 when a Git clone is performed by Moby components (on either the daemon or API client side). However, as these mitigations only apply to certain scenarios (build of `git+<protocol>://...` URL contexts) and cannot protect against a malicious repository already on disk, users should update to a version of Git containing patches for CVE-2022-39253 on all their systems running both API clients and daemons.\n\nSpecifically, patches in Moby (including patches incorporated from BuildKit) protect against the following:\n\n* `docker build` with the legacy builder (e.g. `DOCKER_BUILDKIT` unset or set to 0) of a Git URL context. Note that depending on available API versions and the CLI version, the Git clone operation can take place on either the client or the daemon side. Both must be updated (or have Git updated) to fully protect this build method.\n* `docker build` with the BuildKit builder (e.g. `DOCKER_BUILDKIT=1`) of a Git URL context.\n* `docker buildx build` with `BUILDKIT_CONTEXT_KEEP_GIT_DIR=1` of a Git URL context.\n\nPatches in BuildKit incorporated into Docker Compose protect against CVE-2022-39253 during Compose-driven builds of Git URL contexts.\n\nPatches in Moby and related projects such as BuildKit, the Docker CLI, and Docker Compose **cannot** fully protect against CVE-2022-39253, as it may be triggered by a malicious repository already on disk that a unpatched Git client has interacted with (specifically, commands that check out submodules such as `git clone --recursive`, `git submodule update`, etc.  may have already triggered the Git vulnerability).\n\n### Workarounds\n\nWhile this behavior is unexpected and undesirable, and has resulted in this security advisory, users should keep in mind that building a container entails arbitrary code execution. Users should not build a repository/build context they do not trust, as containerization cannot protect against all possible attacks.\n\nWhen building with BuildKit (e.g. `docker buildx build` or `docker build` with `DOCKER_BUILDKIT=1`), this issue cannot be exploited unless `--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1` was also passed, as by default BuildKit will discard the `.git` directory of a Git URL context immediately after cloning and checking out the repository.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* [Open an issue](https://github.com/moby/moby/issues/new)\n* Email us at [security@docker.com](mailto:security@docker.com)",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/docker/docker"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "20.10.20"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 20.10.19"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/moby/moby/security/advisories/GHSA-vp35-85q5-9f25"
  }, {
    "type" : "WEB",
    "url" : "https://github.blog/2022-10-17-git-security-vulnerabilities-announced"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/moby/moby"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moby/moby/releases/tag/v20.10.20"
  }, {
    "type" : "WEB",
    "url" : "https://lore.kernel.org/git/xmqq4jw1uku5.fsf@gitster.g/T/#u"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-11T00:03:31Z",
    "nvd_published_at" : null
  }
}