/

CVE-2026-58455

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in Dockwatch compose API

CVE-2026-58455

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78, CWE-698

Impact:

Remote Code Execution and Host Compromise

Severity:

CRITICAL RISK

(9.8)

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

Dockwatch contains an unauthenticated OS command injection flaw where attacker-controlled input is passed directly into shell_exec() during Docker compose operations.

By abusing an incomplete authentication redirect and a writable session flag, remote attackers can inject arbitrary commands via a POST parameter and fully compromise the host that runs Dockwatch.

Affected context

This vulnerability appears in Dockwatch deployments that expose the web interface and rely on loader.php for authentication gating.

It is relevant when ajax/compose.php is reachable, uses shell_exec() for Docker compose-related actions, and accepts user-supplied composePath values without sanitization or command-line validation.

The risk is heightened in typical configurations where the Docker socket is mounted into the Dockwatch environment, effectively bridging web-level compromise into container and host-level control.

Exploit preconditions

  • Attack surface: Publicly accessible Dockwatch HTTP endpoints, particularly loader.php and ajax/compose.php.
  • Required access: Network access to the Dockwatch interface; no valid credentials are strictly required due to the incomplete authentication flow.
  • Trigger point: Issuing a composePull action with a crafted composePath POST parameter after seeding the session via the redirect logic in loader.php.
  • Why exploitation is possible: The authentication path fails to terminate execution after redirect, allowing a session flag to be set without full auth, and composePath is passed unsanitized to shell_exec(), enabling direct command injection.

Why this happens

The underlying bug combines two insecure patterns.

First, an incomplete authentication redirect in loader.php (mapping to CWE-698: Incorrect Handling of Exceptional Conditions) fails to call exit(), letting subsequent logic run while setting a session flag that appears to represent authenticated state.

Second, ajax/compose.php uses shell_exec() with unvalidated user input (composePath), directly concatenating or interpolating that value into shell commands, which aligns with CWE-78: OS Command Injection.

Together, these flaws allow untrusted data to be treated as part of executable shell syntax while the intended authorization barrier is effectively bypassed.

Potential impact

  • Remote execution of arbitrary shell commands on the Dockwatch host.
  • Full compromise of the underlying server, including file read/write and process control.
  • Manipulation, creation, or destruction of Docker containers via the mounted Docker socket.
  • Pivoting into other services or networks reachable from the compromised host.
  • Disruption of application availability through resource exhaustion or destructive commands.

General mitigation guidance

Mitigation generally focuses on strengthening both command handling and authentication flow.

For command execution, favor APIs that avoid shell parsing entirely (e.g., direct Docker client libraries or parameterized process execution) and strictly validate any path-like inputs against an allowlist of known-safe locations.

Ensure that authentication redirects terminate execution unambiguously, and centralize authorization checks so that session flags cannot be set or trusted before full verification.

Deploy Dockwatch with least-privilege principles: avoid unnecessary Docker socket exposure, reduce filesystem write access from the web component, and isolate the service within constrained runtime environments to limit the blast radius of any injected command.

How teams detect issues like this

Detection can focus on both code-level and runtime indicators.

At the code level, static analysis rules can flag uses of shell_exec() and similar shell APIs that incorporate variables derived from HTTP request data, especially POST parameters like composePath.

Code review should highlight authentication flows that perform redirects without explicit termination, and any authorization logic that relies solely on session flags set outside a validated login process.

Runtime monitoring can look for anomalous command patterns originating from the Dockwatch process, unexpected container lifecycle events, or unusual access to the Docker socket, all of which may indicate exploitation attempts.

Sources

SourceLink
github.comgithub.com/Notifiarr/dockwatch/pull/135
vulncheck.comvulncheck.com/advisories/dockwatch-unauthenticated-os-command-injection-via-ajax-compose-php

Frequently asked

questions

Yes. Because the authentication redirect does not properly terminate execution and the composePath parameter is unsanitized, a remote attacker with HTTP access to Dockwatch can reach the vulnerable endpoint and inject commands.

In typical scenarios it does not. The flawed authentication flow allows an attacker to seed the required session flag without successfully logging in, so network reachability is the primary prerequisite.

Replace shell-based command construction with safer APIs that do not expose shell parsing, enforce strict validation or allowlisting on all user-supplied parameters, and ensure that authentication redirects immediately exit and centralize enforcement of authorization checks.

Adopt secure coding practices that avoid direct shell execution of user-influenced data, incorporate security-focused code reviews for authentication and authorization logic, and use automated analysis to flag dangerous command execution patterns and incomplete error or redirect handling early in the development lifecycle.

Find out what's already
exploitable in your codebase.