# CVE-2025-62725: Docker Compose Vulnerable to Path Traversal via OCI Artifact Layer Annotations

> Attackers can overwrite arbitrary files on the host by exploiting path traversal in Docker Compose's handling of remote OCI artifact annotations.

- **Severity:** High 8.9 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 27 Oct 2025
- **Updated:** 28 Oct 2025
- **Also known as:** GHSA-gv8h-7v7w-r22q, GO-2025-4077, SUSE-SU-2026:20871-1, UBUNTU-CVE-2025-62725

## What is CVE-2025-62725?

CVE-2025-62725 is a high-severity path traversal vulnerability in docker compose, published on 27 Oct 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

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.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2025-62725?

4 open source packages ship an affected version, including github.com/docker/compose/v2 and github.com/docker/compose.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/docker/compose/v2` | Go | All versions | 2.40.2 |
| `github.com/docker/compose/v2` | Go | From 2.34.0 | 2.40.2 |
| `github.com/docker/compose/v2` | Go | From 2.34.0 | 2.40.2 |
| `github.com/docker/compose` | Go | All versions | None |
| `docker-compose` | SUSE:Linux Micro 6.0 | All versions | 2.33.1-4.1 |

## How do I fix CVE-2025-62725?

Upgrade github.com/docker/compose/v2 to 2.40.2 or later.

## Is CVE-2025-62725 being exploited?

There is no known exploitation of CVE-2025-62725 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-62725 and fix it if it is affected.

What it is: CVE-2025-62725 is a high-severity path traversal vulnerability in docker compose, published on 27 Oct 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2025-62725 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/docker/compose/v2 (Go): affected all versions; fixed in 2.40.2
- github.com/docker/compose/v2 (Go): affected from 2.34.0; fixed in 2.40.2
- github.com/docker/compose/v2 (Go): affected from 2.34.0; fixed in 2.40.2
- github.com/docker/compose (Go): affected all versions; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-62725/ (Markdown: https://insights.sbomify.com/CVE-2025-62725/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-62725
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-62725
- OSV: https://osv.dev/vulnerability/CVE-2025-62725

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-62725/
Summaries are generated and may contain mistakes; the official description above is the record.
