/

CVE-2026-71416

Severity:

HIGH RISK

(8.8)

Origin Validation Bypass (CWE-287) in Headroom WebSocket

CVE-2026-71416

Deferred

Vulnerability type

Category:

Improper Authentication

CWE:

CWE-287, CWE-1385

Impact:

Unauthorized LLM access and API key abuse

Severity:

HIGH RISK

(8.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

Headroom versions before 0.35.0 do not validate the Origin header on incoming WebSocket connections before forwarding requests to an upstream large language model service. A malicious WebSocket client may therefore submit unauthorized LLM requests when it can reach the Headroom proxy and the proxy exposes an OpenAI API key through its environment.

Affected context

The vulnerability occurs in deployments where the Headroom WebSocket server is reachable by untrusted browser-based or headless-browser clients, forwards requests to an upstream LLM provider, and relies on an environment-held API key without an additional client authentication boundary. The risk is higher when cross-origin WebSocket connections are permitted or when network access to the proxy is broader than intended.

Exploit preconditions

  • Attack surface: Headroom's WebSocket endpoint
  • Required access: Network reachability to the Headroom proxy; valid client authentication may not be required
  • Trigger point: Establishment of a WebSocket connection followed by forwarding an LLM request
  • Why exploitation is possible: The server does not adequately validate the client's Origin or otherwise establish that the request came from an authorized application before using its upstream API credentials

Why this happens

The underlying bug is an authentication and origin-trust failure. The WebSocket server accepts client connections without reliably validating the Origin header or applying an equivalent authorization control, then forwards requests using credentials held by the server. This maps primarily to CWE-287: Improper Authentication and is related to CWE-1385: Missing Origin Validation in WebSockets, because an untrusted client can be treated as an authorized browser context.

Potential impact

  • Attackers may submit arbitrary requests to the upstream LLM service
  • The exposed API key may incur unauthorized usage charges or quota consumption
  • Confidential prompts, responses, or proxy-accessible data could be disclosed
  • Attackers could abuse the service for automated or harmful content generation
  • The upstream provider account or connected application may be subject to rate limits or suspension

General mitigation guidance

Mitigation generally focuses on making WebSocket authorization explicit rather than relying on browser behavior or the Origin header alone.

Common defensive patterns include:

  • Enforcing an allowlist of trusted origins before accepting or forwarding WebSocket requests
  • Requiring authenticated, authorized client sessions with appropriate access scopes
  • Separating browser-facing proxy access from server-side upstream API credentials
  • Restricting network exposure of the WebSocket endpoint to trusted applications or networks
  • Applying rate limits, usage quotas, request-size limits, and monitoring around LLM forwarding
  • Storing upstream credentials in protected secret-management systems and minimizing their privileges
  • Rejecting requests by default when origin or authorization information is absent, malformed, or ambiguous

How teams detect issues like this

Detection approaches may include:

  • Static analysis and code review checks for WebSocket handlers that accept connections without origin or authorization validation
  • Reviewing whether upstream API credentials are used for requests from unauthenticated client sessions
  • Testing cross-origin and headless-browser connection attempts in security assessments
  • Monitoring WebSocket connection origins, client identities, request volumes, and unusual LLM usage patterns
  • Enforcing gateway policies that require approved origins, authentication, rate limits, and restricted network sources
  • Using automated security review tools to flag missing WebSocket authentication and origin-validation controls

Sources

SourceLink
github.comgithub.com/headroomlabs-ai/headroom/releases/tag/v0.35.0
github.comgithub.com/headroomlabs-ai/headroom/security/advisories/GHSA-h46j-26q3-rggf

Frequently asked

questions

Yes. An attacker generally needs network access to the Headroom WebSocket endpoint and a client capable of initiating a WebSocket connection, such as a traditional or headless browser.

Not necessarily. The risk arises because the server may use its own environment-held API key when forwarding a request from an unauthorized client.

Validate trusted origins and require explicit client authentication and authorization before accepting or forwarding WebSocket requests. Origin checks should supplement, not replace, authentication.

Treat browser-origin information as an untrusted input, apply deny-by-default WebSocket policies, isolate upstream credentials, restrict endpoint exposure, and monitor usage for anomalous activity.

Find out what's already
exploitable in your codebase.