Summary
A critical authorization and command-injection vulnerability in Dokploy's Swarm API allows a user with server:read permission to reference another organization's server. Under this condition, crafted node-related requests may cause arbitrary commands to run as the configured SSH user on the other tenant's server.
Affected context
The vulnerability occurs in Dokploy deployments where Swarm API procedures accept a serverId without verifying that it belongs to the caller's active organization. The affected node-information path also incorporates a supplied nodeId into a remote command execution operation, creating risk when cross-tenant resource references are accepted.
Exploit preconditions
- Attack surface: Dokploy Swarm API procedures for node and application information
- Required access: An authenticated account with
server:readpermission - Required condition: The caller must be able to submit a serverId belonging to another organization
- Trigger point: Processing of the node-information request and construction of a remote execution command
- Why exploitation is possible: Missing organization ownership checks permit cross-tenant resource access, while unsafely interpolated node identifiers can alter the command executed remotely
Why this happens
The issue combines broken object-level authorization with OS command injection. Several Swarm API procedures trust a supplied serverId without enforcing an active-organization ownership check, corresponding to CWE-639 and CWE-862. The node-information service then interpolates nodeId into a command passed to a remote execution helper. Treating request-controlled data as command syntax creates a CWE-78 condition in which input can affect shell behavior rather than remaining a strictly bounded argument.
Potential impact
- An attacker may execute arbitrary commands as the configured SSH user
- A tenant may access or modify another organization's server resources
- Application data, credentials, or deployment configuration could be exposed
- Compromised hosts could be used for lateral movement or service disruption
- The vulnerability could enable cross-tenant data access and broader platform compromise
General mitigation guidance
Mitigation generally focuses on enforcing authorization before resource lookup
and eliminating shell interpretation of request-controlled values.
Common defensive patterns include:
- Validate server ownership against the authenticated organization on every affected procedure
- Centralize and consistently enforce object-level authorization checks
- Pass command arguments through APIs that do not invoke a shell, rather than interpolating strings
- Apply strict allowlists and type validation to node and server identifiers
- Use dedicated, least-privileged SSH identities with narrowly scoped permissions
- Separate tenant resources and limit the blast radius of remote execution
- Treat authorization failures as deny-by-default and avoid relying only on client-side checks
How teams detect issues like this
Organizations commonly detect this class of issue through:
- Static analysis rules for shell command construction using request-derived data
- Code review checks for missing tenant or organization ownership validation
- Tests that attempt cross-organization resource references with otherwise valid permissions
- Runtime monitoring for unexpected remote commands and unusual SSH activity
- API policy checks requiring authorization at every resource access boundary
- Automated security review tools that flag command interpolation and inconsistent access-control enforcement

