/

CVE-2026-24841

Severity:

CRITICAL RISK

(9.9)

Command Injection in Dokploy WebSocket Docker Terminal

CVE-2026-24841

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on Host Server

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection flaw in Dokploy's /docker-container-terminal WebSocket endpoint allows authenticated users to inject arbitrary shell commands via the containerId and activeWay parameters.

When those parameters are directly interpolated into shell commands without sanitization, an attacker who can access the terminal feature may execute arbitrary commands on the host server running Dokploy.

Affected context

The vulnerability occurs in Dokploy deployments that expose the /docker-container-terminal WebSocket endpoint to authenticated users for container terminal access.

It manifests when user-controlled parameters (containerId and activeWay) are concatenated or interpolated directly into shell commands used to attach to or manage Docker containers.

The issue is relevant wherever Dokploy is reachable over a network and users can initiate terminal sessions against containers, especially in multi-tenant or shared hosting environments.

Exploit preconditions

  • Attack surface: Dokploy's WebSocket endpoint /docker-container-terminal, typically exposed over HTTP(S) to authenticated users.
  • Required access: Valid authentication or any role that can open a container terminal in the Dokploy UI or via API.
  • Trigger point: Establishing or interacting with a WebSocket session where containerId and/or activeWay are supplied and then used to build shell commands.
  • Why exploitation is possible: The parameters are directly interpolated into shell command strings without proper validation, escaping, or use of parameterized process-spawning APIs.

As a result, crafted values can break out of the intended command structure and introduce additional arbitrary shell commands.

Why this happens

This vulnerability stems from building shell commands by string concatenation with untrusted input and then executing them via a shell interpreter.

Instead of treating containerId and activeWay as opaque data passed to a structured API, the implementation embeds them directly into a command line, allowing shell metacharacters to alter command semantics.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where lack of input neutralization lets attackers execute unintended commands with the privileges of the Dokploy service.

Potential impact

  • Execution of arbitrary commands on the Dokploy host server with the Dokploy service's privileges
  • Complete takeover of the host machine, including file system access and process control
  • Compromise of all containers managed by Dokploy, including data exfiltration or tampering
  • Lateral movement within the infrastructure (e.g., accessing other services reachable from the host)
  • Installation of backdoors, cryptominers, or other persistent malware on the host
  • Disruption of services by stopping containers, deleting data, or exhausting system resources

General mitigation guidance

Mitigation should focus on eliminating direct shell interpretation of user-controlled values and tightening trust boundaries around terminal access.

Recommended defensive patterns include:

  • Avoid shell invocation for user parameters: Use direct Docker or container APIs/SDKs (e.g., native libraries or system calls) instead of sh, bash, or generic shell commands when attaching to or managing containers.
  • Strong command construction discipline: Where shell usage cannot be avoided, construct commands using argument arrays (e.g., execve-style APIs) rather than building a single shell-parsed string.
  • Input validation and normalization: Treat containerId and activeWay as identifiers with strict allowed patterns (e.g., alphanumeric plus a limited set of delimiters). Reject or log any values containing whitespace, shell metacharacters, or unexpected length.
  • Least privilege for the service account: Run the Dokploy service under a minimally privileged user account with restricted system permissions to limit blast radius if a command is injected.
  • Segregated execution environment: Isolate the control plane (Dokploy host) from sensitive internal networks and use OS-level isolation (containers, jails, or sandboxing) for the component that interacts with Docker.
  • Role-based access control (RBAC): Restrict who can open container terminals and ensure terminal access is only granted to trusted operators with clear accountability.
  • Defense in depth logging and rate limiting: Log terminal usage and unusual parameter patterns, and apply rate limits to reduce automated exploitation opportunities.

How teams detect issues like this

Detection efforts can combine code-centric and operations-centric approaches:

  • Static analysis patterns:
  • Flag any use of shell execution functions (e.g., exec, system, popen, child_process.exec) where arguments are constructed by concatenating or interpolating request parameters (containerId, activeWay, or similar).
  • Look for generic command strings related to Docker CLI usage being built from WebSocket or HTTP request data.
  • Code review signals:
  • Instances where WebSocket handlers directly pass client-supplied values into command lines or terminal attach logic.
  • Lack of centralized validation or normalization for container identifiers and terminal modes.
  • Use of shell-specific features (pipes, &&, ;, backticks) near user-provided variables.
  • Runtime and logging indicators:
  • Unusual WebSocket activity or parameters containing shell metacharacters such as ;, &&, |, $(, or backticks.
  • Process monitoring that detects unexpected child processes spawned by the Dokploy service or shell interpreters being launched in atypical patterns.
  • Security policy enforcement:
  • CI/CD checks that block introduction of new shell-based command execution paths using raw user input.
  • Integration of automated code review or SAST tools configured with rules for OS command injection patterns.

Sources

SourceLink
github.comgithub.com/Dokploy/dokploy/blob/canary/apps/dokploy/server/wss/docker-container-terminal.ts
github.comgithub.com/Dokploy/dokploy/commit/74e0bd5fe3ef7199f44fcd19c6f5a2f09b806d6f
github.comgithub.com/Dokploy/dokploy/security/advisories/GHSA-vx6x-6559-x35r

Frequently asked

questions

Yes, if Dokploy is accessible over the network and an attacker can authenticate to an account that has access to the /docker-container-terminal endpoint, they can potentially trigger command injection remotely.

Not necessarily. The attacker generally needs any level of authenticated access that permits opening a container terminal or interacting with the affected WebSocket endpoint. Misconfigured roles or overly broad permissions can make exploitation easier.

The most robust fix is to remove shell parsing from the execution path: use structured, parameterized APIs for interacting with Docker or the OS, validate parameters as strict identifiers, and avoid passing user-controlled data to a shell interpreter.

Adopt secure coding guidelines that forbid building shell commands from untrusted data, enforce input validation standards for all externally sourced parameters, and integrate automated security checks (SAST, linters, and mandatory security reviews) into the development lifecycle, especially around remote management or terminal features.

Find out what's already
exploitable in your codebase.