Vulnerabilities in pkg:golang/github.com/docker/compose/v2

PACKAGE
Advisory Identifier: GHSA-gv8h-7v7w-r22q
Advisory Summary

CVE-2025-62725 is a HIGH path traversal vulnerability (CWE-20: Improper Input Validation) affecting Github.com/docker/compose/v2 libraries in the Go ecosystem. The issue involves docker compose vulnerable to path traversal via oci artifact layer annotations. Remediation is available by upgrading affected packages to version 2.40.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/docker/compose/v2

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/docker/compose/v2. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-gv8h-7v7w-r22q CVE-2025-62725 HIGH Docker Compose Vulnerable to Path Traversal via OCI Artifact Layer Annotations

CVE-2025-62725 at a Glance

CVE Identifier CVE-2025-62725
GHSA Identifier GHSA-gv8h-7v7w-r22q
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/docker/compose/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-62725

To remediate this vulnerability, upgrade all affected Github.com/docker/compose/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/docker/compose/v2 fixed: 2.40.2
Upgrade github.com/docker/compose/v2 to 2.40.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/docker/compose/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-62725, inspect your project dependencies for Github.com/docker/compose/v2:

inspect dependencies for github.com/docker/compose/v2

Analyze the terminal output to locate any version of Github.com/docker/compose/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.40.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Github.com/docker/compose/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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. ### Impact 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. ### Patches v2.40.2 ### Workarounds NA

CVE-2025-62725 Affected Github.com/docker/compose/v2 Versions

1 component(s)
Fixed Versions:
2.40.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/docker/compose/v2
Go
≥ 2.34.0
< 2.40.2
2.40.2

References

Frequently Asked Questions

What is CVE-2025-62725?
CVE-2025-62725 is a security vulnerability in Github.com/docker/compose/v2 involving Docker Compose Vulnerable to Path Traversal via OCI Artifact Layer Annotations under CWE-20: Improper Input Validation.
Which Github.com/docker/compose/v2 versions are affected?
Affected versions include releases prior to 2.40.2 across affected packages: github.com/docker/compose/v2.
What version fixes CVE-2025-62725?
Upgrading to 2.40.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/docker/compose/v2 affected?
Yes, github.com/docker/compose/v2 is affected in releases prior to 2.40.2. Upgrade your dependency to 2.40.2 or later.
What CWE is associated with CVE-2025-62725?
CVE-2025-62725 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2025-62725?
Run the dependency tree command: 'inspect dependencies for github.com/docker/compose/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gv8h-7v7w-r22q",
  "modified" : "2025-11-27T08:53:10Z",
  "published" : "2025-10-27T20:19:34Z",
  "aliases" : [ "CVE-2025-62725" ],
  "summary" : "Docker Compose Vulnerable to Path Traversal via OCI Artifact Layer Annotations",
  "details" : "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. \n\n### Impact\nThis 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.\nAn 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.\n\n### Patches\nv2.40.2\n\n### Workarounds\nNA",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/docker/compose/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.34.0"
      }, {
        "fixed" : "2.40.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/docker/compose/security/advisories/GHSA-gv8h-7v7w-r22q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-62725"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/docker/compose/commit/69bcb962bfb2ea53b41aa925333d356b577d6176"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/docker/compose"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-10-27T20:19:34Z",
    "nvd_published_at" : "2025-10-27T21:15:38Z"
  }
}