docker cp flaw lets a container write files onto the host

In short

CVE-2026-17106 the flaw's identifier; 29.7.2 Docker Engine/CLI fixed version, per Imperva; 4.86.0 Docker Desktop fixed version, per Imperva; 0.38.0 Docker Sandboxes release with the sbx cp fix

What does docker cp do, and why can it be abused?

The command looks harmless: docker cp container:/path/to/file.txt ./file.txt. The expectation is that Docker writes to ./file.txt and nowhere else.

But it is not a direct file copy. Imperva explains that the Docker daemon (the background service) walks the container's live files and packs the chosen path into a tar archive, a single stream that bundles files, folders and links. The Docker command-line tool (CLI) on your machine then unpacks it. So the container controls what is in the archive, while the unpacking runs with your permissions.

For that to be safe, two things must hold: the archive must be consistent, and every unpacked item must stay inside the destination. Imperva says it broke both in one copy.

How the attack works

Step 2 is a race condition: the container changes the file between the daemon's two looks at it. Imperva says Docker locks its own bookkeeping while reading, but that does not stop programs inside the container. To win the race reliably, its proof of concept places a large file just before the target and watches for the daemon opening it, then does the two renames.

Step 4 is the second flaw. Imperva says the containment check validated a path built with filepath.Join, while the symlink was created from the archive's original link target. "The check approves one path. The filesystem creates another."

What can an attacker reach?

Imperva says the result is a file create-or-overwrite within the permissions of whoever ran docker cp. The container does not gain root from the Docker daemon, and someone or something must run docker cp on the attacker's container.

Imperva highlights where the copy is routine: CI systems pulling test results, developer machines, and incident responders collecting evidence from a container they already suspect is compromised. It also points to AI coding agents, since Docker Sandboxes uses sbx cp to move files out of an agent's isolated environment.

Imperva validated the exploit on Linux with Docker Engine 29.6.1 and on macOS with Docker Desktop 4.81.0. Its own proof of concept is the evidence; we have not seen independent confirmation, and a severity score (CVSS) was not given in the post.

How do you protect yourself from docker cp attacks?

Imperva's advice, if you cannot upgrade yet:

Disclosure timeline

11 April 2026: Imperva reports the bug to Docker. 15 April: Docker confirms it as a valid finding. 10 July: the initial 90-day disclosure period ends without a public patch. 24 July: Docker provides CVE-2026-17106 and targets a 3 August release. 30 July: go-archive v0.3.0 and Docker Engine/CLI 29.7.0 ship the unpacking fix. 31 July: Docker reports functional regressions from the first fix and asks for more time; follow-up releases address them. 6 August: Docker Sandboxes 0.38.0 fixes the sbx cp variant. 10 August: Docker Desktop 4.86.0, bundling Engine 29.7.2, ships; Imperva publishes.

Imperva adds that Docker decided the daemon-side race would not get its own CVE and would be handled as extra hardening. It describes the unpacking fix as the primary one.

What is not stated or checked

Terms in plain English

Where things stand

Imperva lists Docker Engine and CLI 29.7.2, Docker Desktop 4.86.0 and Docker Sandboxes 0.38.0 as the fixed releases and says its main lesson is that unpacking an archive is a security boundary. Check Docker's advisory GHSA-hfg8-hc9c-6c3h for the authoritative version list.

Sources

Sources

Related stories

More from Vulnerability Research

All stories from Vulnerability Research