Oct 3, 2026·6 min read·16 visits
Headroom proxy prior to v0.35.0 fails to validate the Origin header during WebSocket handshakes, allowing malicious websites to hijack connections, abuse ambient API credentials, and execute arbitrary commands.
A critical cross-site WebSocket hijacking (CSWSH) vulnerability in headroomlabs-ai/headroom prior to version 0.35.0 allows unauthorized external origins to establish connection channels to the Headroom proxy, enabling arbitrary prompt execution and remote code execution through local tool integration.
The Headroom proxy server, developed by headroomlabs-ai, operates as an intermediary for Large Language Model (LLM) communications. The server compresses request payloads before they reach the upstream LLM providers to reduce processing latency and operational costs. The application exposes an interactive WebSocket endpoint at /v1/responses to facilitate real-time streaming operations between client endpoints and LLM backends.
Prior to version 0.35.0, the WebSocket upgrade handler for the /v1/responses route accepted incoming connection handshakes without performing validation on the HTTP Origin header. Because web browsers do not restrict cross-origin WebSocket connections under the Same-Origin Policy (SOP), any third-party website loaded in a user's browser can initiate a direct connection to a local or internal Headroom proxy on the user's behalf.
This flaw represents a severe weakness matching CWE-1385 (Missing Origin Validation in WebSockets) and CWE-287 (Improper Authentication). If the target proxy runs with ambient authentication credentials—such as the OPENAI_API_KEY stored in server-side environment variables—the incoming hijacked WebSocket session inherits those credentials automatically. This allows unauthorized third-party origins to query upstream models and run local tool suites.
The core technical flaw exists within the WebSocket handshake negotiation implementation. In a standard HTTP application, the browser maintains strict logical boundaries between origins via the Same-Origin Policy (SOP). However, WebSocket connections are explicitly excluded from SOP protections at the browser layer, allowing web scripts to construct connection tunnels to arbitrary targets across different domains.
To compensate for this open transport model, the WebSocket protocol specification requires browsers to append an Origin header to the initial HTTP upgrade handshake request. Target servers are responsible for reading this header and verifying that the requesting origin matches an explicit allowlist. If the server fails to inspect the Origin header during handshake processing, it remains vulnerable to Cross-Site WebSocket Hijacking (CSWSH).
In vulnerable deployments of the Headroom proxy, the FastAPI/ASGI handler accepting connections at /v1/responses accepted the upgrade handshake unconditionally. Once the handshake succeeded, the connection was elevated to a persistent TCP-based WebSocket stream. If the incoming request did not include explicit client authorization tokens, the backend automatically fell back to the administrative server-side OPENAI_API_KEY environment variable, effectively authenticating the hijacked session without client interaction.
The remediation commit c632023cc1ec61d15f8f8e86efe3b54d51604a64 introduces origin verification checks prior to the establishment of the WebSocket session. Below is an analysis of the validation sequence implemented within headroom/proxy/handlers/openai.py to prevent unauthorized cross-origin connections:
def _is_allowed_websocket_origin(headers: dict[str, str]) -> bool:
# Native clients (like curl, CLI tools) commonly omit Origin headers. This absence is allowed.
origin = _header_get(headers, "origin")
if not origin:
return True
allowed_origins = _allowed_ws_origins_from_env()
if allowed_origins is None:
# Fallback to loopback validation if no custom origins are configured
return _is_loopback_ws_origin(origin)
if "*" in allowed_origins:
return True
normalized_origin = _normalize_origin(origin)
if normalized_origin is None:
return False
normalized_allowed = {
normalized
for allowed in allowed_origins
for normalized in (_normalize_origin(allowed),)
if normalized is not None
}
return normalized_origin in normalized_allowedDuring the execution of handle_openai_responses_ws, the server retrieves the headers from the initial handshake. If the origin validation fails, the proxy generates an explicit warning log and closes the websocket session immediately using WebSocket close code 1008 (Policy Violation), halting downstream processing.
if not _is_allowed_websocket_origin(ws_headers):
logger.warning(
"event=websocket_origin_not_allowed request_id=%s session_id=%s path=%s origin=%r",
request_id,
session_id,
_ws_path,
_header_get(ws_headers, "origin"),
)
await websocket.close(code=1008, reason="origin not allowed")
returnExploitation of this vulnerability requires three prerequisites. First, the victim must run the vulnerable Headroom proxy locally or within a reachable private subnet. Second, the proxy must hold active API credentials. Third, the victim must navigate to an attacker-controlled web page.
The attacker-controlled webpage hosts a background JavaScript payload designed to connect to the local Headroom proxy loopback address. When the victim accesses this webpage, the browser executes the script and initiates a connection upgrade request to ws://localhost:8787/v1/responses on the local machine.
Because the browser automatically appends the actual site origin to the connection request, the request headers contain Origin: https://attacker.com. Since the vulnerable proxy lacks verification controls, it completes the handshake. The attacker script can then send formatted JSON commands down the open channel to trigger model operations, exploit local command-execution integrations, or extract sensitive query histories.
The impact of a successful CSWSH exploit on the Headroom proxy is classified as High. Because the proxy processes system commands and connects directly to critical corporate development infrastructure, a hijacked connection bypasses perimeter security protections.
An attacker who establishes a WebSocket channel can issue commands to any connected agent tooling. If the Headroom agent has access to system shells or file-system utilities, the attacker can execute arbitrary commands directly on the host computer running the proxy. This effectively turns a cross-site scripting/phishing vector into an unauthenticated remote code execution exploit.
Additionally, the unauthorized use of LLM credits presents financial and availability concerns. Attackers can execute batch requests to exhaust API quotas or harvest conversation logs containing confidential internal code, proprietary schemas, and access tokens stored in past prompt outputs.
The primary resolution is to upgrade all Headroom proxy installations to version v0.35.0 or higher. This version implements strict Origin header checking and rejects non-loopback connections by default unless an explicit configuration override is provided.
For deployments where immediate upgrading is not possible, administrators should bound the proxy listening socket strictly to the loopback interface (127.0.0.1 or ::1) instead of all interfaces (0.0.0.0). This restricts access from other systems on the network and reduces the attack surface.
If cross-origin access is required, define specific allowed origins using the HEADROOM_WS_ORIGINS or HEADROOM_CORS_ORIGINS environment variables. Avoid using wildcards (*) in production configurations, as wildcards restore the vulnerable state by disabling origin matching logic.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
headroom headroomlabs-ai | < 0.35.0 | v0.35.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1385 (Missing Origin Validation in WebSockets) |
| Attack Vector | Network (Requires User Interaction) |
| CVSS v3.1 Score | 8.8 |
| EPSS Score | 0.00219 (Percentile: 11.24%) |
| Exploit Status | Proof of Concept (PoC) available |
| CISA KEV Status | Not Listed |
The application does not validate the Origin header during the WebSocket handshake, allowing cross-site WebSocket hijacking.
CVE-2026-129299 (GHSA-24mq-4vc6-2prf) is a parsing and serialization flaw in SpamScope mail-parser prior to version 4.6.2. The library uses reflective Python attribute resolution (getattr) over untrusted email header names and applies caller convenience transformations (such as underscore-to-hyphen folding and _json/_raw suffix stripping) directly to wire headers. An unauthenticated remote attacker can send crafted emails that trigger uncaught TypeError exceptions during JSON serialization or cause security-relevant headers and body content to be silently dropped without setting defect indicators.
CVE-2026-129236 is a command-line argument injection vulnerability (CWE-88) in Kubeshark, an eBPF-based network observability tool for Kubernetes. Located within the Model Context Protocol (MCP) server implementation in cmd/mcpRunner.go, the flaw occurs when handling the start_kubeshark tool request. When the MCP server runs with the --allow-destructive flag, the callStartKubeshark function appends the caller-supplied pod_regex parameter directly to the kubeshark tap argument slice without an end-of-options (--) delimiter. Because Kubeshark uses the Cobra and pflag libraries for command-line parsing, any pod_regex value prefixed with a hyphen is interpreted as a CLI flag rather than a positional regular expression. An attacker capable of influencing MCP tool arguments, such as through indirect prompt injection against a connected Large Language Model (LLM) agent, can inject the --set flag to override Helm chart values like tap.docker.registry. Because Kubeshark deploys its worker DaemonSet with privileged security contexts and host networking enabled, redirecting the container image registry allows arbitrary code execution as root across all Kubernetes cluster nodes.
Kubeshark versions 53.1.0 prior to 53.4.0 contain an arbitrary file write and path traversal vulnerability (CWE-22) alongside an argument injection vulnerability (CWE-88) in the Model Context Protocol (MCP) server implementation (cmd/mcpRunner.go). The download_file tool fails to validate caller-supplied path and dest arguments, allowing an attacker who influences an AI agent driving kubeshark mcp to write Kubeshark Hub API responses to arbitrary locations writable by the local user. Additionally, the start_kubeshark tool appends the pod_regex argument without flag delimiters, allowing argument injection into the kubeshark tap subcommand.
CVE-2026-129300 (GHSA-xhrq-2mqv-q8wx) is an unhandled exception vulnerability in SpamScope mail-parser, a Python library used to parse raw emails. When processing an email with a malformed Received header containing an out-of-range year or timezone offset, standard library datetime conversion routines raise OverflowError or OSError. Because the internal error handler only caught TypeError and ValueError, these exceptions escape the parser hierarchy, terminating email ingestion pipelines and causing a denial of service.
CVE-2026-129301 (GHSA-8cgq-x343-p74c) is an uncaught exception and MIME interpretation conflict vulnerability in the Python email parsing library mail-parser (versions >= 4.6.0 and < 4.6.3). The write_attachments() function iterates over parsed email attachments without per-attachment exception containment. When processing a specially crafted MIME part containing an RFC 2231-encoded null byte in the filename, a basename exceeding filesystem NAME_MAX limits, or a malformed base64 payload, the function raises an unhandled standard library exception (ValueError, OSError, or binascii.Error). This prematurely aborts the attachment extraction loop, preventing subsequent attachments from being written to disk for downstream security inspection while also triggering unhandled worker crashes in applications that only catch MailParserError.
Directus versions prior to 12.3.1 contain an authorization bypass and privilege management flaw in the SharesService component. Authenticated non-administrative users with update permissions on the directus_shares collection can modify the user_created, role, item, and collection fields of an existing owned share. Because the update operation validates permissions solely against the pre-update record state without revalidating the modified fields, an attacker can reassign share ownership and role context to an administrator. Subsequent guest access using the share token derives administrative accountability, exposing restricted relational data.