HighGHSA-rg2x-37c3-w2rhCVE-2026-42306GO-2026-5617

Docker: Race condition in docker cp allows bind mount redirection to host path

Published 18 May 2026 · Updated 10 Sept 2026

Is your project on an affected github.com/docker/docker?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected packages

Affected
<=28.5.2
Fixed in
No fix released
Affected
<2.0.0-beta.14
Fixed in
2.0.0-beta.14
Update to the fixed version for your release line, for example:go get github.com/moby/moby/v2@v2.0.0-beta.14
Affected
<=28.5.2
Fixed in
No fix released

Details

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 cp completes), 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 cp into that container, or call the PUT /containers/{id}/archive or HEAD /containers/{id}/archive API 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 cp with untrusted running containers.
  • Use authorization plugins to restrict access to the archive API endpoints (PUT /containers/{id}/archive, HEAD /containers/{id}/archive).

Is GHSA-rg2x-37c3-w2rh in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/docker/docker, and gives you the command that fixes it.

More advisories for github.com/docker/docker

  • LowCVE-2026-41568Race condition in 'docker cp' in github.com/docker/docker allows creation of arbitrary files · 25 Jun 2026
  • LowCVE-2026-41567Docker: 'PUT /containers/{id}/archive' executes container binary on the host in github.com/docker/docker · 25 Jun 2026
  • MediumCVE-2026-41568Docker: Race condition in docker cp allows creation of arbitrary empty files on the host via symlink swap · 18 May 2026
  • HighCVE-2026-41567Docker: `PUT /containers/{id}/archive` executes container binary on the host · 18 May 2026
  • LowCVE-2026-33997Moby has an Off-by-one error in its plugin privilege validation in github.com/docker/docker · 2 Apr 2026
  • LowCVE-2026-34040Moby has AuthZ plugin bypass when provided oversized request bodies in github.com/docker/docker · 2 Apr 2026
All 66 advisories for github.com/docker/docker

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.