DEV Community

SorrelThorncroft
SorrelThorncroft

Posted on

docker cp can let a running container race a read-only bind mount into a host write

docker cp can let a running container race a read-only bind mount into a host write

Docker Engine 29.10.1 fixes a race condition in docker cp mount setup. CVE-2026-135124 affects Engine versions before 29.10.1. A process in a running container can change a path between the time the daemon bind-mounts a volume and the time it applies read-only flags. The intended mount can remain writable while an archive is extracted into the container, allowing files to modify a host directory that was meant to be protected.

The GitHub advisory labels the issue Moderate. The exact impact depends on which host files are exposed through the bind mount and whether an attacker can copy files into a running container with that mount configuration.

Conditions that matter

Containers without read-only bind mounts are not affected. Stopped containers are not affected because no container process can interfere during the copy. Copies out of the container are also unaffected because they do not write through the mounts. Rootless Docker is affected, but the impact is limited to files accessible to the daemon's user.

This is not a generic container-escape trigger for every workload. It is a host-write path created when a privileged copy operation meets a malicious process and a writable-by-design container filesystem.

Patch and reduce the path

Upgrade to 29.10.1 or later. Verify the daemon version on all hosts, not only the CLI version. Then review automation that copies files into running containers. Restrict it to trusted images, trusted processes, and a dedicated destination that is not a host-sensitive bind mount.

Use the narrowest possible bind mounts. A read-only flag is important, but the underlying host path still needs limited permissions. Avoid mounting a broad host directory into a container that runs untrusted code.

Do not rely on container immutability as a substitute for the patch. A process can still change paths within its container filesystem, and malicious content can be introduced by an image, build, or application bug.

Test the operational path

Create a non-production container with a read-only bind mount and copy an archive into it while a controlled process attempts the race. The test should prove that the host path cannot be modified after the fix. Repeat with a stopped container and with copy-out to confirm the documented unaffected cases.

Review audit logs for docker cp use against production containers, especially copies initiated by automation outside a change window. Preserve the source archive hash and destination path when investigating a suspected write.

Verification checklist

  • Confirm Docker Engine is 29.10.1 or later.
  • Inventory automation and users allowed to run docker cp.
  • Review running containers with read-only host bind mounts.
  • Test copy-in behavior in a controlled environment.
  • Investigate unexpected host-file changes and preserve source artifacts.

References

Top comments (0)