/

CVE-2026-42454

Severity:

CRITICAL RISK

(9.9)

OS Command Injection in Termix Docker Container Management

CVE-2026-42454

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on managed servers

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

Termix's Docker container management endpoints interpolate user-controlled container IDs directly into shell commands executed over SSH without sanitization or validation.

An authenticated attacker who can reach these endpoints may craft a malicious container ID to inject arbitrary operating system commands, resulting in Remote Code Execution on any managed server.

Affected context

This vulnerability exists in Termix deployments where:

  • Termix is configured to manage Docker containers on remote servers via SSH
  • Docker container operations (start/stop/inspect/logs/exec, etc.) are implemented by constructing shell commands that include the containerId
  • The containerId value comes from:
  • URL path parameters on HTTP endpoints, and
  • WebSocket message fields
  • These values are used directly inside shell command strings passed to ssh2.Client.exec() without strict validation or escaping

In such contexts, any authenticated user with access to the Docker management features can influence the commands executed on the managed hosts.

Exploit preconditions

  • Attack surface: Termix HTTP and WebSocket endpoints that handle Docker container management actions.
  • Required access: Valid authenticated access to Termix with permissions to invoke container operations (depending on deployment, this could be standard user or elevated roles).
  • Trigger point: Sending a request or WebSocket message that sets the containerId to a value containing command separator characters or shell metacharacters.
  • Why exploitation is possible: The application performs string interpolation of untrusted containerId values directly into shell command lines executed remotely via ssh2.Client.exec(). The shell interprets injected metacharacters as additional commands, enabling arbitrary OS command execution.

Why this happens

The core issue is a classic command injection pattern: untrusted input is concatenated into shell commands executed by the application.

Termix's Docker management functions construct command strings such as docker <subcommand> <containerId> by directly interpolating user-controlled values (from URL parameters and WebSocket messages) without:

  • type enforcement or allowlisting of acceptable container ID formats, or
  • proper escaping or use of non-shell-based execution APIs.

When these constructed command strings are passed to ssh2.Client.exec(), they are interpreted by a shell on the remote server. Any shell metacharacters present in the containerId (e.g., command separators, redirection operators, or subshell syntax) are processed as part of the command, mapping directly to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

Potential impact

  • Remote Code Execution with the privileges of the user account used by Termix on the managed servers
  • Full compromise of managed servers, including installation of backdoors or persistence mechanisms
  • Unauthorized access to sensitive data stored or processed on those servers
  • Lateral movement to other systems reachable from compromised hosts
  • Disruption of services by stopping containers, deleting data, or consuming system resources
  • Potential escalation of privileges if combined with local privilege escalation vulnerabilities on the managed hosts

General mitigation guidance

Effective mitigation focuses on eliminating direct shell interpolation and reducing trust in user-supplied identifiers:

  • Avoid shell command construction with untrusted data: Prefer using structured, parameterized APIs or libraries (e.g., Docker SDKs or native client libraries) instead of building shell commands as strings.
  • Enforce strict input validation and allowlisting: Treat containerId as a constrained identifier. Validate it against a strict pattern (e.g., specific character sets and length) and reject or normalize any value that deviates from expected formats.
  • Use command argument arrays, not shell parsing: Where shell execution cannot be avoided, use APIs that accept an argument list instead of parsing a single command string, and ensure that untrusted data is passed only as non-interpreted arguments.
  • Implement least privilege on managed servers: Run the SSH account used by Termix with minimal permissions necessary for container management, and avoid granting it broader system-level capabilities than required.
  • Apply defense-in-depth controls: Consider restricting which containers or hosts a given Termix user can operate on, enforcing authorization checks at the application level to limit the blast radius of a compromised account.

How teams detect issues like this

Detection efforts can target both code-level patterns and runtime anomalies:

  • Static analysis and code scanning:
  • Flag instances where user-controlled data (e.g., HTTP path params, WebSocket fields) flows into shell command construction.
  • Define rules for functions and methods that form command strings and pass them to SSH execution APIs like ssh2.Client.exec().
  • Highlight string concatenation or template literals that include both constant command fragments (e.g., docker) and request-derived variables.
  • Code review practices:
  • Require reviewers to identify any use of shells for remote management operations and verify that only validated, allowlisted inputs are used.
  • Add checklist items focusing on "no direct shell command construction with user input" and "use SDKs instead of shell commands where possible."
  • Runtime monitoring and logging:
  • Log all commands executed via Termix on managed servers, including the originating user and request context.
  • Use log analysis or SIEM rules to detect suspicious patterns, such as unexpected shell metacharacters in container IDs or unusually complex command lines.
  • Policy and governance:
  • Introduce secure coding standards specific to command execution and remote-management features, and enforce them via CI pipelines and automated review tools.

Sources

SourceLink
github.comgithub.com/Termix-SSH/Termix/releases/tag/release-2.1.0-tag
github.comgithub.com/Termix-SSH/Termix/security/advisories/GHSA-c2g2-hqgq-6w9v

Frequently asked

questions

Yes, if Termix is exposed over the internet and an attacker can obtain valid credentials, they can reach the affected endpoints remotely. Exploitability depends on network exposure, authentication strength, and access controls configured around Termix.

The attacker must be an authenticated Termix user with the ability to invoke Docker container management endpoints. They do not need direct shell access to the managed servers; the vulnerability abuses Termix's own SSH-based execution.

Replace shell-based command construction with structured API calls (e.g., Docker or container-management SDKs) that accept parameters without invoking a shell. Where shell usage is unavoidable, apply strict allowlist validation to all identifiers and pass them only as non-interpreted arguments, never embedded in command strings.

Adopt a defensive design approach where no untrusted data is ever interpolated into shell commands. Establish secure coding guidelines, use static analysis to detect command construction with user input, and favor high-level libraries over direct shell execution for infrastructure and management operations.

Find out what's already
exploitable in your codebase.