Severity:

HIGH RISK

(8.0)

OS Command Injection in Cockpit System Logs UI

CVE-2026-4802

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on Host System

Severity:

HIGH RISK

(8.0)

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

Cockpit contains an OS command injection vulnerability in its system logs UI, where user-controlled parameters from crafted links are incorporated into shell commands without proper sanitization.

A remote attacker who can get such crafted values processed by the UI can inject shell metacharacters and command substitutions, resulting in arbitrary command execution on the host and potential full system compromise.

Affected context

The vulnerability arises in Cockpit deployments where the system logs UI processes user-controlled parameters taken from links or log entries and forwards them to shell commands.

It is relevant when:

  • Cockpit is exposed over the network and accessible to users or external systems
  • Log-related operations or helpers invoke shell commands using these parameters
  • Input is passed to the shell without robust escaping or argument separation

The issue does not depend on a specific platform but on the presence of shell invocation with untrusted data in the system logs UI handling.

Exploit preconditions

  • Attack surface: Network-accessible Cockpit web interface, specifically the system logs UI.
  • Required access: Ability to influence or provide values used in crafted links or log entries that the system logs UI will process (e.g., via remote log sources, services that log attacker-controlled data, or crafted URLs).
  • Trigger point: A Cockpit user or automated process causes the system logs UI to process and act on log entries or links containing attacker-controlled parameters.
  • Why exploitation is possible: The application composes shell commands using these parameters without strict validation, proper escaping, or use of safe non-shell invocation APIs, allowing shell metacharacters and command substitution syntax to be interpreted by the shell.

Why this happens

This vulnerability is rooted in OS command injection (CWE-78).

The system logs UI code path constructs shell commands that include data derived from user-controlled parameters, likely by concatenating strings or passing them through the shell rather than as discrete, safely escaped arguments.

When input containing shell metacharacters or command substitution is passed directly to a shell, the shell parses and executes the injected fragments as part of the command.

Abstractly, this is the insecure pattern where untrusted input is treated as part of a command line, allowing the interpreter (shell) to interpret control characters and execute additional commands.

Potential impact

  • Execution of arbitrary commands with the privileges of the Cockpit backend process.
  • Complete compromise of the underlying host system, including installation of backdoors or malware.
  • Exfiltration or tampering of sensitive data and configuration files.
  • Lateral movement to other systems through stolen credentials or pivoting from the compromised host.
  • Disruption of services, including stopping critical processes or wiping data.

General mitigation guidance

Effective mitigation focuses on removing direct shell interpretation of untrusted input and hardening how commands are invoked:

  • Prefer APIs that execute commands without a shell (e.g., process execution interfaces that take argument arrays and do not invoke a shell parser).
  • When a shell cannot be avoided, apply strict allowlist-based validation of all parameters, rejecting or normalizing any unexpected characters or patterns.
  • Treat all log-derived values as untrusted; do not blindly propagate log fields into command lines, and avoid passing them through to the shell at all.
  • Apply the principle of least privilege to the Cockpit backend so that, if command execution is abused, the blast radius is reduced.
  • Separate responsibilities so that UI-triggered actions operate through narrowly scoped services with limited, predefined commands instead of generic shell access.

How teams detect issues like this

Detection typically combines code-level analysis with runtime monitoring:

  • Use static analysis rules to flag string concatenation or template-based construction of shell commands that include request parameters, log-derived fields, or other untrusted sources.
  • During code review, watch for use of generic shell execution APIs (e.g., system-like calls, shell=True-style helpers) in UI or log-handling paths, and require justification or refactoring to safer patterns.
  • Enforce development policies that prohibit direct shell invocation with untrusted data and require argument-based process execution APIs by default.
  • Employ security testing (including fuzzing and dynamic analysis) against the system logs UI to identify inputs that cause unexpected command behavior.
  • Centralized logging and host-based intrusion detection can be configured to alert on anomalous command patterns originating from Cockpit-related processes.

Sources

SourceLink
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21390
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21392
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21394
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21395
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21468
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21515
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21516
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21647
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21676
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21700
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-4802
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2451155
github.comgithub.com/cockpit-project/cockpit/blob/e204cd130/pkg/systemd/logsJournal.jsx#L206-L210
openwall.comopenwall.com/lists/oss-security/2026/05/20/19
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-4802.json

Frequently asked

questions

Yes, it can be remotely exploitable if an attacker can cause the Cockpit system logs UI to process attacker-controlled parameters from links or log entries over the network.

The attacker needs a way to influence parameters that the logs UI will process—this might be through interacting with services that write to logs, supplying crafted URLs, or accessing Cockpit in a way that lets them introduce those parameters. Direct shell access is not required.

Replace any shell-based command construction that incorporates user or log-derived data with non-shell process execution using explicit argument arrays, combined with strict allowlists for any remaining dynamic values.

Establish a coding standard that forbids passing untrusted data to shells, mandate safe command execution APIs, treat log content as untrusted input, and use automated analysis plus code review checklists to catch command construction patterns early in development.

Find out what's already
exploitable in your codebase.