Summary
Coolify's application deployment workflow contains a command injection weakness where untrusted Docker Compose directives from low-privileged project members are used to control host-level container operations.
By defining a malicious service that mounts sensitive host paths and executes attacker-controlled commands, a user with limited permissions can escape container isolation and run arbitrary code on the underlying host.
Affected context
This vulnerability affects Coolify environments where:
- Project members with low-privileged roles can create or update applications,
- User-supplied Docker Compose configuration is accepted and used to orchestrate containers,
- The deployment engine runs with access to the host Docker daemon and can mount host filesystems.
In such setups, Compose directives provided by untrusted users may be applied with elevated privileges, allowing them to influence how containers interact with the host.
Exploit preconditions
- Attack surface: Web-based project/application management interface in Coolify.
- Required access: Authenticated low-privileged member capable of creating or updating a project or its Docker Compose configuration.
- Trigger point: Submission or modification of an application definition that includes attacker-controlled services and directives in the Compose specification.
- Why exploitation is possible: The deployment pipeline treats user-controlled Docker Compose content as trusted input, passing it to the container runtime with host-level permissions. This allows crafted directives (e.g., privileged containers, host mounts, custom commands) to influence the host OS and execute arbitrary commands, mapping to CWE-78 when those directives effectively translate into system-level operations.
Why this happens
The core issue is that Coolify's deployment workflow implicitly trusts Docker Compose configuration supplied or modified by low-privileged users without adequate validation or policy enforcement.
In this model, user-controlled configuration influences how Docker is invoked and what capabilities containers receive, including volume mounts to the host filesystem and runtime commands.
Because Docker and Compose directives can be used to run arbitrary binaries and scripts within a privileged context, this becomes a form of command injection (CWE-78: Improper Neutralization of Special Elements used in an OS Command), where the "command" surface is the container orchestration layer rather than a direct shell string.
The lack of guardrails around privileged settings, host mounts, and runtime commands allows a crafted service definition to become an execution vehicle on the host.
Potential impact
- Host-level remote code execution as root via a compromised container.
- Full read/write access to the host filesystem through mounted volumes.
- Exfiltration or tampering of sensitive data, configuration files, and application secrets stored on the host.
- Modification of other containers, images, and Docker resources managed by the same daemon.
- Installation of persistence mechanisms or malware on the host.
- Use of the compromised host as a pivot point to attack other internal systems.
General mitigation guidance
Effective mitigation focuses on reducing trust in user-supplied deployment configuration and minimizing the privileges of the deployment engine:
- Constrain Docker Compose capabilities: Introduce a strict allowlist or policy layer for Compose directives (e.g., disallow hostPath-like mounts, privileged containers, and direct access to the Docker socket in user-controlled services).
- Separate trust levels: Use distinct execution paths or roles for configuration supplied by untrusted members versus admin-defined, vetted configurations.
- Enforce least privilege: Run the deployment engine with the minimal Docker and host privileges necessary, avoiding broad root-level access where possible.
- Isolate infrastructure: Place orchestration components in isolated contexts (e.g., separate hosts or VMs) to limit blast radius if configuration is abused.
- Introduce review and approval: Require administrative review for risky configuration changes, especially those related to volumes, capabilities, and custom entrypoints or commands.
These patterns aim to ensure that high-privilege host interactions are not directly controllable by low-privileged users through configuration alone.
How teams detect issues like this
Organizations can detect and monitor for this class of issue using a mix of proactive and reactive techniques:
- Static analysis and policy checks: Scan configuration repositories and CI pipelines for dangerous Docker Compose patterns such as mounting
/,/var/run/docker.sock, or other sensitive host paths, as well asprivileged: trueor extensive capabilities. - Code and configuration review: During review of infrastructure-as-code and application definitions, flag any paths where low-privileged users can influence deployment descriptors that result in host-level changes.
- Runtime monitoring: Use host and container monitoring tools to detect abnormal container behavior, such as containers accessing sensitive host directories or executing unexpected binaries.
- Audit logging: Enable detailed logging of deployment actions, including who changed Compose configurations and what directives were applied, then periodically review logs for suspicious patterns.
- Automated policy enforcement: Employ tools such as admission controllers, policy engines (e.g., container security policies), or custom validators to block deployments that violate predefined security rules.

