Cyber Security News

Docker Compose Flaw Lets Attackers Overwrite Arbitrary Files

A path traversal vulnerability discovered in Docker Compose allows attackers to write arbitrary files to host systems through specially crafted OCI artifacts.

Tracked as CVE-2025-62725, the flaw was discovered in early October 2025 and carries a high severity rating of 8.9 CVSS.

CVE IDCVE-2025-62725
ComponentDocker Compose OCI Artifacts
Vulnerability TypePath Traversal / Arbitrary File Write
CVSS 3.1 Score8.9 (High)
Affected VersionsDocker Compose prior to v2.40.2

The vulnerability puts millions of Docker Compose deployments at risk, from development environments to enterprise CI/CD pipelines and cloud infrastructure.

How the Vulnerability Works

Docker Compose recently introduced support for OCI-based Compose artifacts, enabling developers to fetch and include Compose files from remote registries.

While this feature improves portability, it created a dangerous gap in file path validation. When Compose processes remote OCI layers, it trusts annotations that specify where downloaded files should be written to disk.

An attacker can craft these annotations with path traversal sequences that escape the intended cache directory entirely, allowing files to be written anywhere on the host system.

The vulnerable code failed to normalize or validate paths before writing them to disk. This means an attacker could inject a malicious annotation directing Compose to write files into sensitive system locations like SSH directories, configuration folders, or other critical areas where the Compose process has write permissions.

What makes this vulnerability particularly dangerous is that users don’t need to explicitly start containers to trigger it.

Seemingly harmless commands like “docker compose ps” or “docker compose config” force Compose to fetch and reconstruct remote OCI artifacts, automatically triggering the vulnerability without the user realizing they’re processing untrusted content.

An attacker needs only to trick a victim into running any Compose command in a directory containing a malicious docker-compose.yaml file.

In the proof-of-concept demonstration, an attacker could inject their SSH public key into the target system’s authorized_keys file, granting immediate remote access, as reported by Imperva.

This could happen without any containers starting and without any explicit write operation from the user. The attack chain is simple yet devastatingly effective.

Docker released a patch in Docker Compose v2.40.2 and later that introduces proper path validation.

The fix normalizes and validates all annotation-derived paths before writing them to disk, rejecting any paths that resolve outside the cache directory or contain absolute paths.

Organizations using Docker Compose should upgrade immediately to the patched version to prevent exploitation.

Follow us on Google News, LinkedIn, and X to Get Instant Updates and Set GBH as a Preferred Source in Google.

Divya

Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Recent Posts

Hackers Use ConnectWise SkyKick Credentials to Access Microsoft 365, Halting Cloud Backups

Attackers abused compromised ConnectWise Cloud Backup credentials to access Microsoft 365 customer environments, prompting ConnectWise…

1 day ago

Anthropic’s Claude AI Uncovers Origins of NSA-Provided Cryptographic Keys After 25 Years

Anthropic says an internal Claude research model reconstructed how the National Security Agency generated seeds…

1 day ago

Critical WordPress Flaws Allow Attackers to Execute Remote Code Without Authentication

Two WordPress Core vulnerabilities can be chained to execute remote code without authentication, according to…

1 day ago

OpenBSD Kernel Flaw Dating Back 37 Years Enables Local Privilege Escalation to Root

A newly disclosed OpenBSD kernel exploitation chain combines a shared memory accounting flaw with a…

1 day ago

GhostAction Hackers Hide Credential-Stealing Malware in Fake Font Files Across 94 GitHub Repositories

GhostAction attackers have expanded their GitHub credential theft campaign with a second stage that disguises…

2 days ago

SideCopy Hackers Target Indian Organizations With ReverseRAT Malware to Steal Data

Indian authorities have warned that SideCopy hackers are targeting Indian organizations, including academic institutions, with…

2 days ago