Summary
Dokploy contains an authorization flaw in the server removal API that allows an authenticated privileged user from one organization to act on a server belonging to another organization. If the user knows the other server's identifier, they may delete its registration and deployment records and obtain its plaintext SSH private key.
Affected context
The issue affects Dokploy deployments using the server removal tRPC mutation in the vulnerable release range. It becomes risky when an authenticated owner or administrator has server deletion permission in one organization and can provide or otherwise learn a server identifier belonging to a different organization. The removal operation does not consistently verify that the target server belongs to the caller's active organization, despite related read operations enforcing that boundary.
Exploit preconditions
- Attack surface: Dokploy's authenticated server-management API
- Required access: An authenticated owner or administrator with
server:deletepermission in an organization - Required knowledge: A valid server identifier associated with another organization
- Trigger point: The server removal mutation
- Why exploitation is possible: Authorization is not checked against the target server's organization before deletion and related cleanup operations are performed
Why this happens
The vulnerability results from an object-level authorization failure. The server identifier is caller-controlled, but the removal workflow does not verify that the resolved server belongs to ctx.session.activeOrganizationId before performing destructive actions and returning sensitive server data. This behavior maps to CWE-639: Authorization Bypass Through User-Controlled Key, where an application trusts a user-supplied object reference without enforcing ownership or tenant authorization.
Potential impact
- An attacker may delete another organization's server registration
- Deployment records associated with the target server could be removed
- Management of affected deployments may be interrupted
- The plaintext SSH private key associated with the server could be disclosed
- The exposed credential could enable unauthorized access to the managed host
- Cross-organization data or operational boundaries could be weakened
General mitigation guidance
Mitigation generally focuses on enforcing authorization at the point where every referenced resource is resolved and acted upon.
Common defensive patterns include:
- Derive organization scope from the authenticated session rather than trusting client-supplied organization identifiers
- Perform an explicit tenant-ownership check before every read, update, deletion, cleanup, and credential-return operation
- Use centralized authorization policies for resource-level access decisions
- Apply fail-closed behavior when the target resource is missing, ambiguous, or outside the active organization
- Avoid returning plaintext private keys through routine management responses; prefer protected secret storage and narrowly scoped retrieval
- Limit destructive permissions through least privilege and require additional confirmation or approval for high-impact operations
- Treat server identifiers as references only, not as evidence that the caller is authorized to access the referenced resource
How teams detect issues like this
Organizations can look for:
- Static analysis and code review rules requiring tenant or ownership checks for every caller-controlled resource identifier
- API tests that attempt cross-organization access to read, update, delete, and credential-return endpoints
- Signals where a request's active organization differs from the target resource's organization
- Audit events showing deletion or secret retrieval for resources outside the caller's normal organizational scope
- Policy checks that prevent sensitive credentials from being included in general-purpose API responses
- Automated authorization testing and repository review tools that identify inconsistent checks between related API procedures

