Summary
Coolify exposes the root user's private SSH key to low-privileged users in versions up to and including v4.0.0-beta.434, enabling them to authenticate as root on the underlying server.
When a user with limited permissions can view this key via the Coolify interface or stored configuration, they can bypass normal access controls and gain full system-level control over the host.
Affected context
This vulnerability affects Coolify deployments where:
- The Coolify instance manages servers and uses an SSH private key associated with the root user on the host.
- The application stores or renders this private key in a way that is accessible to low-privileged users through the UI or API.
- Role-based access controls or data segregation do not prevent non-admin users from viewing sensitive configuration details.
The issue is most critical on instances where the exposed key is actively used to authenticate as root or as a highly privileged account on the underlying server or other managed servers.
Exploit preconditions
- Attack surface: Coolify web interface and/or associated APIs.
- Required access: Valid low-privileged Coolify account with the ability to access views or endpoints that expose configuration, connection details, or deployment settings.
- Trigger point: Viewing or exporting the configuration or connection details where the root SSH private key is displayed or retrievable.
- Why exploitation is possible: Sensitive authentication material (the root user's SSH private key) is stored and presented without proper secrecy boundaries, allowing it to be read by users who should not have access to this credential.
Why this happens
The core issue aligns with CWE-522: Insufficiently Protected Credentials.
In this case, the application treats a highly sensitive credential—the root user's SSH private key—as general configuration data rather than as secret material that must be strictly protected.
This typically manifests as:
- Storing the private key in application-accessible storage without compartmentalization.
- Exposing the key in UI components, logs, or APIs that are accessible to non-admin users.
- Lack of proper role-based access control and secret-handling abstractions for high-value credentials.
Conceptually, the bug is that a credential intended only for backend, privileged use is directly visible to untrusted or semi-trusted tenants of the system.
Potential impact
- Attackers may authenticate to the Coolify server as the root user over SSH.
- Attackers can gain full administrative control of the underlying operating system.
- Attackers could install backdoors, modify or destroy data, and pivot to other systems reachable from the compromised server.
- Compromise of other servers or services that trust the same private key, if reused.
- Loss of confidentiality for all data and secrets stored on the affected host.
General mitigation guidance
Effective mitigation focuses on treating all SSH private keys and similar credentials as secrets, isolating them both logically and operationally from regular application users.
Non-prescriptive defensive patterns include:
- Secret isolation: Store SSH private keys in a dedicated secret store or OS-level secret management facility, not as regular application configuration values.
- Principle of least privilege: Avoid using the root account for automated access where possible; use dedicated, minimally privileged accounts and distinct keys per function or environment.
- Access control layering: Ensure that any interface that can reveal or handle secrets is restricted to highly privileged administrative roles, with explicit authorization checks and auditing.
- Non-display of secrets: Design the system so that credentials are never fully displayed after initial provisioning; if necessary, allow rotation or re-upload, but not retrieval of the raw secret.
- Key compartmentalization: Use different keys for different servers and roles, limiting blast radius if a key is inadvertently exposed.
- Operational hygiene: Regularly rotate SSH keys and immediately replace any key that may have been exposed, in conjunction with revoking its trust (e.g., updating
authorized_keys).
How teams detect issues like this
Detection can focus on both code-level indicators and operational signals:
- Code and configuration review:
- Identify locations where SSH keys or other sensitive credentials are stored, serialized, or rendered.
- Verify that secret values are never passed to UI templates, logs, or low-privilege APIs.
- Ensure RBAC checks wrap any configuration export or diagnostic endpoints.
- Static analysis patterns:
- Rules that flag handling of private key material (e.g., PEM-formatted content) in controller or view layers.
- Detection of code paths that read secrets from storage and then are used to render HTTP responses.
- Policy enforcement:
- CI/CD checks that block merging code which logs or returns credential-like values.
- Infrastructure policies that enforce separation of secret storage from general application data.
- Runtime monitoring:
- Logging and alerting on unusual access to configuration or settings pages by low-privileged accounts.
- SSH access monitoring for root logins, especially following access to sensitive areas of the Coolify UI.
Automated review tools—static analyzers, secret scanners, and configuration auditors—can complement manual review by systematically scanning for secret exposure patterns.

