github.com/docker/docker
Affected
- introduced
0, last affected28.5.2(semver)
Fixed versions
None listed
Fix
No fixed version is listed.
Advisory
Also known as: CVE-2026-41568, GO-2026-5668
Docker: Race condition in docker cp allows creation of arbitrary empty files on the host via symlink swap
Summary
A race condition during docker cp mount setup allows a malicious container to create empty files or directories at arbitrary absolute paths on the host filesystem.
This advisory covers the race during mountpoint creation. The related race during the subsequent mount syscall is tracked in GHSA-rg2x-37c3-w2rh
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 path is first resolved within the container's root filesystem using GetResourcePath, and then used to create the mountpoint (file or directory) if it does not already exist via createIfNotExists.
Between path resolution and mountpoint creation, a process running inside the container can swap a path component for a symlink pointing to an arbitrary location on the host. Because createIfNotExists operates on the already-resolved absolute path using standard os.MkdirAll and os.OpenFile — which follow symlinks in intermediate path components — the symlink is followed and the file or directory is created outside the container root filesystem, as root.
Impact
A malicious container can create empty files or directories at arbitrary absolute paths on the host filesystem, running as root. This enables persistent denial of service — for example:
/etc/docker/daemon.json into a directory prevents the daemon from restarting/etc/nologin prevents user loginsThe container does not gain read or write access to existing host files — only the ability to create new empty files or directories at chosen paths.
Conditions for exploitation
docker cp into that container, or call the PUT /containers/{id}/archive or HEAD /containers/{id}/archive API endpoints.Not affected
Patches
Mountpoint creation is now scoped to the container root using os.Root (Go 1.24+), which refuses to follow symlinks that escape the opened root directory. All filesystem operations in createIfNotExists (MkdirAll, OpenFile) are performed through the os.Root handle, so even if a symlink swap occurs after path resolution, the creation stays confined to the container root.
Workarounds
docker cp with untrusted running containers.PUT /containers/{id}/archive, HEAD /containers/{id}/archive).Medium Basis: The source's own band: MODERATE
0, last affected 28.5.2 (semver)None listed
No fixed version is listed.
0, fixed 2.0.0-beta.14 (semver)2.0.0-beta.14
2.0.0-beta.14go get github.com/moby/moby/[email protected]0, last affected 28.5.2 (semver)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0