Docker Compose Path Traversal Vulnerability via OCI Artifact Layer Annotations

Vulnerability

A path traversal vulnerability has been identified in Docker Compose versions prior to 2.40.2. This issue arises because Docker Compose trusts the path information in remote OCI compose artifacts. When a layer includes certain annotations, Compose concatenates the attacker-supplied values with its local cache directory, potentially allowing an attacker to escape the cache directory and overwrite arbitrary files on the host machine. This vulnerability can be exploited even when using read-only commands such as 'docker compose config' or 'docker compose ps'.

Impact

Exploitation of this vulnerability allows for arbitrary file overwriting on the machine running Docker Compose, which could lead to significant disruption or unauthorized changes to the system.

Reproduction

The vulnerability can be reproduced by creating an OCI compose artifact that includes the 'com.docker.compose.extends' or 'com.docker.compose.envfile' annotations. When this artifact is processed by Docker Compose, the specified values will be combined with the local cache directory path. If the annotations are crafted to include path traversal sequences, they can escape the cache directory and overwrite files on the host system.

Remediation

Users can upgrade to Docker Compose version 2.40.2 or later to address this vulnerability.

Added: Oct 27, 2025, 9:19 PM
Updated: Oct 27, 2025, 9:19 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
5.0
exploitability
7.0
remediation
7.7
relevance
0.8
threat
4.8
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.