CVE-2026-42306: Docker: Race condition in docker cp allows bind mount redirection to host path
Summary A race condition during docker cp mount setup allows a malicious container to redirect a bind mount target to an arbitrary host path, potentially overwriting host files or causing denial of service. Details When copying files into a container, the daemon sets up a temporary filesystem view by bind-mounting volumes into a private mount namespace.
Published May 18, 2026 · Updated Jun 12, 2026
Affected packages
github.com/docker/docker
- Ecosystem
- Go
- Affected
- <= 28.5.2
- Fixed in
- No patched version yet
- Check
go list -m github.com/docker/docker
github.com/moby/moby/v2
- Ecosystem
- Go
- Affected
- < 2.0.0-beta.14
- Fixed in
- 2.0.0-beta.14
- Check
go list -m github.com/moby/moby/v2
github.com/moby/moby
- Ecosystem
- Go
- Affected
- <= 28.5.2
- Fixed in
- No patched version yet
- Check
go list -m github.com/moby/moby
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
A race condition during docker cp mount setup allows a malicious container to redirect a bind mount target to an arbitrary host path, potentially overwriting host files or causing denial of service.
Details
When copying files into a container, the daemon sets up a temporary filesystem view by bind-mounting volumes into a private mount namespace. During this setup, the mount destination is created inside the container root and then a bind mount is attached using the container-relative path resolved to an absolute host path.
Between mountpoint creation and the mount() syscall, a process running inside the container can replace the destination (or a parent path component) with a symlink pointing to an arbitrary location on the host. The mount() syscall follows the symlink, causing the volume to be bind-mounted onto an arbitrary host path instead of the intended container path.
Impact
A malicious container can redirect a volume bind mount to an arbitrary host path. The impact depends on the volume content and mount options:
- If the volume is writable, arbitrary host files at the redirected path could be overwritten with the volume's contents.
- If the volume is read-only, the host path is masked by the mount for the duration of the operation, causing denial of service.
- In all cases the mount is temporary (torn down after the
docker cpcompletes), but the effects of any writes persist.
Conditions for exploitation
- A container must have at least one volume mount.
- A process inside the container must be able to rapidly create and swap symlinks at the volume mount destination path.
- An operator must initiate a
docker cpinto that container, or call thePUT /containers/{id}/archiveorHEAD /containers/{id}/archiveAPI endpoints.
Not affected
- Containers that do not have volume mounts are not affected, as the race occurs during volume bind-mount setup.
Workarounds
- Only run containers from trusted images.
- Avoid using
docker cpwith untrusted running containers. - Use authorization plugins to restrict access to the archive API endpoints (
PUT /containers/{id}/archive,HEAD /containers/{id}/archive).
Credited to vvoland.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-41567
Docker: `PUT /containers/{id}/archive` executes container binary on the host
high7.2No fixMay 18, 2026CVE-2026-41568
Docker: Race condition in docker cp allows creation of arbitrary empty files on the host via symlink swap
medium6.1No fixMay 18, 2026CVE-2026-33997
Moby has an Off-by-one error in its plugin privilege validation
medium6.8No fixMar 27, 2026CVE-2026-34040
Moby has AuthZ plugin bypass when provided oversized request bodies
high8.8Mar 27, 2026CVE-2025-54388
Moby firewalld reload makes published container ports accessible from remote hosts
medium4.6Jul 29, 2025CVE-2025-54410
Moby firewalld reload removes bridge network isolation
low3.3Jul 29, 2025
