Red Hat Cockpit `logsJournal.jsx` Shell Injection RCE (CVE-2026-4802)
by hakaioffsec (Hakai Security / QuimeraX Intelligence) · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-4802
- Category
- web
- Affected product
- Red Hat Cockpit — the web-based Linux system administration console (cockpit-project.org), specifically pkg/systemd/logsJournal.jsx. **Not** to be confused with the headless "Cockpit CMS".
- Affected versions
- Unpatched Cockpit versions containing the vulnerable loadServiceFilters() logic in pkg/systemd/logsJournal.jsx
- Disclosed
- 2026-07-05
- Patch status
- unpatched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | hakaioffsec (Hakai Security / QuimeraX Intelligence) |
| CVE / Advisory | CVE-2026-4802 |
| Category | web |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | cockpit, redhat, shell-injection, command-injection, rce, websocket, systemd, journalctl |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Red Hat Cockpit — the web-based Linux system administration console (cockpit-project.org), specifically pkg/systemd/logsJournal.jsx. Not to be confused with the headless “Cockpit CMS”. |
| Versions Affected | Unpatched Cockpit versions containing the vulnerable loadServiceFilters() logic in pkg/systemd/logsJournal.jsx |
| Language / Platform | Cockpit frontend in JavaScript/JSX driving server-side shell execution over the Cockpit WebSocket protocol; PoC written in Python (asyncio + websockets) |
| Authentication Required | Yes (a low-privileged authenticated user, e.g. viewer) |
| Network Access Required | Yes |
Summary
Cockpit’s systemd logs page builds a journalctl invocation from URL-fragment-derived filter parameters (such as --since=) inside loadServiceFilters(). The resulting argument array is joined into a single shell string with only whitespace escaping and then executed via /bin/bash -ec, so shell metacharacters — notably command substitution $(...) — are not neutralized. Any authenticated user who can reach the logs page (even a low-privileged viewer account) can inject and execute arbitrary shell commands on the Cockpit host through this path.
Vulnerability Details
Root Cause
loadServiceFilters() in pkg/systemd/logsJournal.jsx constructs the journalctl command line by joining an array of arguments (including a --since=<value> filter sourced from the logs page URL fragment) with " ", escaping only literal spaces in each token before handing the full string to /bin/bash -ec. Because shell metacharacters like $(...) are not escaped, an attacker-controlled --since=$(shell command) value is executed as a real command substitution by bash.
Attack Vector
- Attacker authenticates to the Cockpit web console as any user with access to the systemd logs page (e.g.
viewer). - Attacker obtains a Cockpit session cookie via
/cockpit/loginand opens a WebSocket connection to/cockpit/socketusing thecockpit1subprotocol. - Attacker opens a
spawnchannel that runs/bin/bash -ec "<journalctl invocation with --since=$(payload) >file>", mirroring what the vulnerableloadServiceFilters()logic would build from a crafted logs-page URL fragment. - Bash evaluates the
$(payload)command substitution embedded in the--since=filter beforejournalctlever runs, executing the attacker’s shell command on the host. - Attacker reads back command output/results via a second
spawnchannel (e.g.caton the output file), or pivots directly to a reverse shell.
Impact
Authenticated remote code execution as the Cockpit bridge/session user on the host running Cockpit — a system administration console that typically has significant control over the underlying OS (services, users, storage), making this a high-value target for privilege escalation and lateral movement.
Environment / Lab Setup
Target: Cockpit web console (vulnerable build), exposed on :9090 (Dockerfile provided builds a vulnerable container)
Attacker: Python 3 with `websockets` library, valid Cockpit credentials (e.g. viewer/viewer)
Proof of Concept
PoC Script
See
poc.py(andDockerfileto build a vulnerable test target) in this folder.
| |
The script authenticates over HTTP Basic auth to obtain a session cookie, opens the Cockpit WebSocket channel, and spawns /bin/bash -ec with a journalctl --since=$(...) payload embedding the attacker’s command; check mode verifies exploitation by reading back a marker file, exec returns command output, and reverse sends a bash reverse-shell one-liner.
Detection & Indicators of Compromise
Signs of compromise:
- Bash or shell processes spawned as children of the Cockpit bridge shortly after logs-page WebSocket activity
- Unexpected outbound connections (reverse shells) originating from the Cockpit host
- Log entries or files created by commands embedded in journalctl
--since=parameters
Remediation
| Action | Detail |
|---|---|
| Primary fix | Apply the vendor patch for CVE-2026-4802 once released; ensure loadServiceFilters() passes arguments to journalctl as an argv array (no shell interpretation) rather than a concatenated shell string |
| Interim mitigation | Restrict Cockpit access to trusted admin networks/VPN, disable or limit access to the systemd logs page for low-privileged accounts, and monitor for anomalous child processes of the Cockpit bridge |
References
- Source repository
- https://bugzilla.redhat.com/show_bug.cgi?id=2451155
- https://access.redhat.com/security/cve/CVE-2026-4802
- https://www.cve.org/CVERecord?id=CVE-2026-4802
Notes
Mirrored from https://github.com/hakaioffsec/CVE-2026-4802 on 2026-07-05. Note: the target is Red Hat’s Cockpit web administration console (cockpit-project.org), not the unrelated headless “Cockpit CMS” product.
| |