GHSA-rg2x-37c3-w2rh
Race Condition vulnerability in docker (Go)
What is GHSA-rg2x-37c3-w2rh About?
This vulnerability is a race condition during `docker cp` mount setup that allows a malicious container to redirect a bind mount target to an arbitrary host path. This can lead to overwriting host files or causing denial of service. Exploitation requires specific conditions but can be achieved with a malicious container and user interaction.
Affected Software
- github.com/docker/docker
- <=28.5.2
- github.com/moby/moby/v2
- <2.0.0-beta.14
- github.com/moby/moby
- <=28.5.2
Technical Details
When a user initiates a docker cp operation to copy files into a container (or uses the equivalent API endpoints PUT /containers/{id}/archive or HEAD /containers/{id}/archive), the daemon temporarily sets up a private mount namespace by bind-mounting volumes. The process involves creating a mount destination inside the container's root and then attaching a bind mount using the container-relative path, which is resolved to an absolute host path. During the brief window between the creation of this mountpoint and the mount() syscall, a process running within the malicious container can exploit a race condition. It replaces the intended destination (or a parent component of its path) with a symlink that points to an arbitrary location on the host filesystem. Consequently, when the mount() syscall is executed, it follows this malicious symlink, resulting in the volume being bind-mounted onto an attacker-controlled host path instead of the intended container path.
What is the Impact of GHSA-rg2x-37c3-w2rh?
Successful exploitation may allow attackers to overwrite arbitrary host files with the contents of the bind-mounted volume, or to cause a temporary denial of service by masking a host path, preventing access to legitimate files.
What is the Exploitability of GHSA-rg2x-37c3-w2rh?
Exploitation of this vulnerability is complex and requires several prerequisites. The attacker needs to control a process running inside a container that has at least one volume mount. This containerized process must be capable of rapidly creating and swapping symlinks at the volume mount destination path to win the race condition. Authentication to the Docker daemon itself is typically not required, as the attack leverages a legitimate command (docker cp) or API calls (PUT /containers/{id}/archive, HEAD /containers/{id}/archive) performed by an operator. The attacker requires privileges sufficient to execute arbitrary code within the container to manipulate the filesystem with symlinks. The attack is initiated remotely by an operator using docker cp or the API, making it a remote-triggerable vulnerability that relies on user interaction. Risk factors include running untrusted containers or allowing docker cp operations into running containers.
What are the Known Public Exploits?
| PoC Author | Link | Commentary |
|---|---|---|
| No known exploits | ||
What are the Available Fixes for GHSA-rg2x-37c3-w2rh?
Available Upgrade Options
- github.com/moby/moby/v2
- <2.0.0-beta.14 → Upgrade to 2.0.0-beta.14
Struggling with dependency upgrades?
See how Resolved Security's drop-in replacements make it simple.
Book a demoAdditional Resources
What are Similar Vulnerabilities to GHSA-rg2x-37c3-w2rh?
Similar Vulnerabilities: CVE-2023-28841 , CVE-2022-24348 , CVE-2022-0734 , CVE-2020-15257 , CVE-2019-14271
