Docker CopyEscape CVE-2026-17106 Lets Malicious Containers Overwrite Host Files
Docker patches CopyEscape (CVE-2026-17106), which lets malicious containers overwrite host files during docker cp via a symlink race, potentially enabling root code execution.
Imperva's Red Team disclosed CVE-2026-17106 (CopyEscape), a critical Docker vulnerability in the docker cp copy-out path combining a filesystem race condition with unrestricted archive extraction, allowing a malicious container to create or overwrite files on the host. A proof of concept replaced /usr/bin/runc with an attacker-controlled script, converting arbitrary file overwrite into root-level code execution. The flaw also affects Docker Sandboxes' sbx cp command, raising risks in AI agent and coding workflows that retrieve artifacts from untrusted sandboxes. Users should upgrade to Docker Engine and CLI 29.7.2, Docker Desktop 4.86.0, or Sandboxes 0.38.0 or later.
- Race condition plus symlink handling in docker cp enables arbitrary host file overwrite
- Imperva PoC replaced /usr/bin/runc to achieve root code execution on Linux
- Docker Sandboxes sbx cp also vulnerable, risking AI agent artifact retrieval workflows
- Patches in Docker Engine/CLI 29.7.2, Desktop 4.86.0, Sandboxes 0.38.0
Vulnerabilities mentionedAll →
- CVE-2026-171067.1<1%Path Traversal via Link Following in Moby go-archive Tar Extractionpublished · Docker / Moby project moby/go-archive (tar extraction routines: Unpack, UnpackLayer, Untar/UntarUncompressed, ApplyLayer helpers)
| CVE | Vulnerability | CVSS | EPSS | Flags | Affected | Exposure | Published |
|---|---|---|---|---|---|---|---|
| CVE-2026-17106 | Path Traversal via Link Following in Moby go-archive Tar Extraction The tar extraction routines in moby/go-archive (Unpack, UnpackLayer, Untar/UntarUncompressed, and the ApplyLayer helpers) fail to confine filesystem operations to the destination directory: entry placement is decided with lexical string checks, but the actual filesystem operations follow OS-resolved paths, so links shipped inside an archive can escape the extraction target. An attacker who controls the contents of an archive being extracted — for example a malicious image layer or a supplied tar handled by Moby-based tooling — can create or overwrite files at arbitrary paths writable by the extracting process. The CVSS 4.0 vector (AV:L, AT:P, UI:A) indicates exploitation requires local access to the extraction context plus certain preconditions, rather than remote unauthenticated access. Anyone running software that embeds the vulnerable moby/go-archive routines, notably Moby/Docker-based container engines that apply image layers or unpack untrusted archives, is potentially affected. There is no evidence of exploitation so far: no public proof-of-concept, not listed in CISA KEV, and EPSS puts 30-day exploitation probability at 0.3%. |
Full article588 words · extracted from gbhackers.com · click to collapse
A critical Docker vulnerability tracked as CVE-2026-17106, also known as CopyEscape, could allow a malicious container to overwrite files on the host machine when a user runs the `docker cp` command.
This vulnerability affects copy-out operations, where Docker retrieves data from a container and extracts it onto the system running the Docker Command Line Interface (CLI).
Docker CopyEscape Flaw
Imperva’s Red Team identified the issue in Docker’s archive-processing path. Although `docker cp` appears to be a simple file-transfer utility, copying from a container to the host involves multiple stages.
Docker’s daemon first packages the requested container content as a tar archive, and then the Docker CLI extracts that archive locally. This means an attacker controlling the source container can influence the archive’s contents, which the local Docker user processes.
CopyEscape exploits two weaknesses in this process. First, a running malicious container can trigger a race condition while Docker scans its filesystem to build the archive.
Docker may initially recognize a path as a directory and decide to explore it, but an attacker can replace that directory with a symbolic link before Docker records its metadata. Consequently, the archive can describe the same path as both a symlink and a directory containing child files.
The second issue arises during extraction. The Docker CLI does not consistently restrict every filesystem operation to the user-specified destination.
A carefully crafted symlink entry could point outside of the designated output directory, while a subsequent child file entry could be written through that link. As a result, a command intended to copy a file to a safe path could inadvertently create or overwrite data elsewhere on the host.
The impact of this vulnerability depends on the privileges of the person or process executing the `docker cp` command. For instance, a developer copying files from a container controlled by an attacker could overwrite important files such as shell startup files, SSH settings, cloud configuration, source code, local binaries, or user-level persistence mechanisms.
On macOS, the Docker CLI performs the extraction on the host rather than within Docker Desktop’s Linux virtual machine, further exposing files in the user’s macOS filesystem.
On Linux, the consequences become more severe if `docker cp` is invoked with elevated privileges. Imperva’s proof of concept demonstrated that it could replace `/usr/bin/runc` with an attacker-controlled script.
A subsequent Docker operation would then execute the modified binary, turning the arbitrary host-file overwrite into root-level code execution.
Notably, the container does not automatically gain root privileges from the Docker daemon; instead, it exploits the authority already granted to the host-side copy process.
This flaw also affects Docker Sandboxes. Docker confirmed that the `sbx cp` command, which transfers files out of isolated sandbox environments, is vulnerable to the same destination-escape condition.
This raises risks in AI agent and coding workflows where users retrieve artifacts from untrusted or compromised sandbox sessions.
To mitigate these risks, Docker users should upgrade to Docker Engine and CLI version 29.7.2 or later, Docker Desktop version 4.86.0 or later, and Docker Sandboxes version 0.38.0 or later.
Until these patches are deployed, organizations should avoid copying data from live untrusted containers, stop containers before retrieving files, avoid using root to run `docker cp` workflows, and use isolated environments when collecting evidence or artifacts from suspected compromised containers.
Cut every SOC alert investigation by 21 min. Power your SOC with instant IOC context for immediate response: Integrate TI Lookup in your SOC
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.