Docker Compose Vulnerable to Path Traversal via OCI Artifact Layer Annotations
docker compose
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| github.com/docker/compose/v2 Go |
|
|
| github.com/docker/compose Go |
| No fix yet |
docker compose
| Product | Affected | Fixed in |
|---|---|---|
| github.com/docker/compose/v2 Go |
|
|
| github.com/docker/compose Go |
| No fix yet |
Docker Compose trusts the path information embedded in remote OCI compose artifacts. When a layer includes the annotations com.docker.compose.extends or com.docker.compose.envfile, Compose joins the attacker‑supplied value from com.docker.compose.file/com.docker.compose.envfile with its local cache directory and writes the file there. This affects any platform or workflow that resolves remote OCI compose artifacts, Docker Desktop, standalone Compose binaries on Linux, CI/CD runners, cloud dev environments is affected. An attacker can escape the cache directory and overwrite arbitrary files on the machine running docker compose, even if the user only runs read‑only commands such as docker compose config or docker compose ps. This issue is fixed in v2.40.2.
From the CVE record · GitHub_M
Docker Compose trusts file paths embedded in remote OCI Compose artifacts and can write files outside its local cache. An attacker who controls an artifact resolved by Compose can overwrite files on the machine running it, even when a user runs a read-only command such as `docker compose config` or `docker compose ps`.
Anyone running Docker Compose v2.34.0 through versions before v2.40.2, or any version of the Go package github.com/docker/compose, should check workflows that resolve remote OCI Compose artifacts.