CVE-2026-41568: Moby: Race condition in docker cp allows creation of arbitrary empty files on the host via symlink swap

Published May 18, 2026
·
Updated

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:

- Converting /etc/docker/daemon.json into a directory prevents the daemon from restarting - Creating /etc/nologin prevents user logins - Overwriting critical system paths with empty files can break host services

The 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

- A container must be running with a process that can rapidly create and swap symlinks at a 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.

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

- 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).

Other sources

Moby is an open source container framework. In Docker Engine prior to version 29.5.1, Docker Daemon versions 28.5.2 and prior, and Moby Daemon prior to version 2.0.0-beta.14, 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 issue has been patched in Docker Engine version 29.5.1 and Moby Daemon version 2.0.0-beta.14.

MITRE

Affected Software

19 affected componentsFixes available
go/github.com/moby/moby<=28.5.2
go/github.com/moby/moby/v2<2.0.0-beta.14
2.0.0-beta.14
go/github.com/docker/docker<=28.5.2
Docker Engine<29.5.1
Mobyproject Moby<=28.5.2
Mobyproject Moby\/v2=2.0.0-beta0
Mobyproject Moby\/v2=2.0.0-beta1
Mobyproject Moby\/v2=2.0.0-beta10
Mobyproject Moby\/v2=2.0.0-beta11
Mobyproject Moby\/v2=2.0.0-beta12
Mobyproject Moby\/v2=2.0.0-beta13
Mobyproject Moby\/v2=2.0.0-beta2
Mobyproject Moby\/v2=2.0.0-beta3
Mobyproject Moby\/v2=2.0.0-beta4
Mobyproject Moby\/v2=2.0.0-beta5
Mobyproject Moby\/v2=2.0.0-beta6
Mobyproject Moby\/v2=2.0.0-beta7
Mobyproject Moby\/v2=2.0.0-beta8
Mobyproject Moby\/v2=2.0.0-beta9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/moby/moby/v2 to a version that resolves this vulnerability.

    Fixed in 2.0.0-beta.14
  2. Upgrade

    Upgrade go/github.com/docker/docker to a version that resolves this vulnerability.

    Fixed in 29.5.1
  3. Upgrade

    Upgrade go/github.com/moby/moby to a version that resolves this vulnerability.

    Fixed in 2.0.0-beta.14
  4. Compensating control

    Only run containers from trusted images to reduce the risk of a malicious container performing symlink swaps.

  5. Compensating control

    Avoid using docker cp (and the PUT /containers/{id}/archive or HEAD /containers/{id}/archive API endpoints) with untrusted running containers.

  6. Compensating control

    Use authorization plugins to restrict access to the archive API endpoints (PUT /containers/{id}/archive and HEAD /containers/{id}/archive) so untrusted users/clients cannot trigger docker cp into running containers.

Event History

May 18, 2026
Advisory Published
via GitHub·05:52 PM
Data Sourced
via GitHub·05:52 PM
DescriptionSeverityWeaknessAffected Software
Jun 12, 2026
CVE Published
via MITRE·06:08 PM
Data Sourced
via MITRE·06:08 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:16 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-41568?

CVE-2026-41568 has a medium severity rating of 6.1.

2

How do I fix CVE-2026-41568?

To mitigate CVE-2026-41568, ensure you are using a patched version of Docker that resolves the race condition during mountpoint creation.

3

What are the potential impacts of CVE-2026-41568?

CVE-2026-41568 allows a malicious container to create empty files or directories at arbitrary absolute paths on the host filesystem.

4

Which software is affected by CVE-2026-41568?

CVE-2026-41568 affects Docker software, including go/github.com/moby/moby, go/github.com/moby/moby/v2, and go/github.com/docker/docker.

5

What kind of vulnerability is CVE-2026-41568 categorized as?

CVE-2026-41568 is categorized as a race condition.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203