Summary
An OS command injection flaw in Coolify's file storage handling allows authenticated users to influence shell commands via unvalidated path parameters.
When a user with permission to add file storage supplies crafted mount paths, Coolify builds shell commands with unescaped values, which can result in arbitrary command execution on the server.
Affected context
This vulnerability appears in Coolify deployments where authenticated users are allowed to add or manage file storage volumes.
The issue arises in logic that:
- Constructs shell commands in
LocalFileVolume::saveStorageOnServerusingfs_pathandparent_dirbefore validation or escaping - Accepts user-controlled file-mount paths via
submitFileStoragewithout sufficient validation
It is most relevant in multi-user or shared-hosting environments where non-admin users can define storage locations or mounts.
Exploit preconditions
- Attack surface: Web interface or API endpoints that allow adding or configuring file storage.
- Required access: Valid authenticated account with permissions to create or modify file storage volumes.
- Trigger point: Submission of a crafted storage configuration where
fs_path,parent_dir, or file-mount path is processed and passed into shell commands. - Why exploitation is possible: User-controlled path values are concatenated into shell commands without proper sanitization or strict validation, enabling injection of additional command syntax interpreted by the underlying OS shell.
Why this happens
The underlying bug is a classic OS command injection (CWE-78) pattern.
Application logic constructs shell commands by interpolating user-controlled values such as file paths (fs_path, parent_dir, mount paths) into command strings before applying validation, escaping, or normalization.
Because these values can contain characters meaningful to the shell, the resulting command string can be altered to execute arbitrary commands.
The absence of strict input validation and the reliance on shell command construction rather than safer, parameterized APIs create an unsafe boundary between application input and operating system execution.
Potential impact
- Authenticated users may be able to execute arbitrary OS commands on the Coolify host.
- Attackers could read, modify, or delete files accessible to the Coolify process.
- Compromise of other services or applications running on the same server.
- Installation of backdoors or persistence mechanisms on the host system.
- Lateral movement to connected infrastructure or data stores, depending on host privileges and network topology.
General mitigation guidance
Mitigation typically focuses on eliminating direct shell command construction and constraining how filesystem paths are handled:
- Replace shell command construction with language-native filesystem, process, or container APIs that do not interpret shell metacharacters.
- If shell execution is unavoidable, use safe process-spawning functions with argument arrays and avoid invoking a shell interpreter.
- Enforce strict validation and normalization of path input, allowing only expected characters and directory structures (e.g., whitelisting directories, disallowing shell metacharacters).
- Apply least-privilege principles for the Coolify process, limiting filesystem and OS capabilities so that command execution, if abused, has reduced impact.
- Separate roles and restrict which authenticated users are allowed to configure or add storage volumes.
How teams detect issues like this
Organizations can detect and monitor for this class of issue using multiple approaches:
- Static application security testing (SAST) rules to flag string-based shell command construction that includes user-supplied input.
- Code review checklists that explicitly call out shell invocation sites and require validation/escaping of all parameters.
- Runtime monitoring or intrusion detection on the host to watch for unusual command execution patterns originating from the Coolify process.
- Logging and alerting around storage configuration changes and unexpected mount path values that contain suspicious characters.
- Periodic security scans or automated review tools focused on command injection patterns in server management and orchestration software.

