/

CVE-2026-59224

Severity:

HIGH RISK

(8.0)

Authentication Bypass (CWE-287) in Open WebUI Terminals

CVE-2026-59224

Analyzed

Vulnerability type

Category:

Authentication and Identity Bypass

CWE:

CWE-287, CWE-290

Impact:

Authentication Bypass and Identity Impersonation

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

Open WebUI terminal routing previously constructed upstream URLs using unencoded session identifiers and blindly forwarded user identity headers.

An attacker able to inject crafted query parameters could impersonate other users' identities in the terminal backend, potentially gaining unauthorized access to their sessions or actions.

Affected context

This vulnerability affects Open WebUI deployments that expose the terminal functionality through backend/open_webui/routers/terminals.py.

The risk is present when:

  • Terminal WebSocket/HTTP traffic is proxied via ws_terminal endpoints
  • Session identifiers are accepted from client-controlled sources
  • Upstream URLs and query parameters are constructed directly from these values
  • The backend trusts X-User-Id or similar headers as proof of identity without cryptographic binding

Exploit preconditions

  • Attack surface: Terminal WebSocket/HTTP endpoint used to connect to backend terminals.
  • Required access: Ability to send crafted requests to the terminal route (e.g., authenticated user or any user permitted to open terminals).
  • Trigger point: Construction of the ws_terminal upstream URL and forwarding of identity-related query parameters/headers.
  • Why exploitation is possible: The implementation builds the upstream URL from an unencoded session_id and appends user_id as a query parameter, allowing query injection that changes the effective user identity. Additionally, the HTTP proxy path forwards X-User-Id as an integrity-unbound identity claim, so the terminal backend may treat attacker-controlled values as authoritative.

Why this happens

The root cause lies in improper authentication and identity binding between the WebUI and the terminal backend.

The router logic:

  • Fails to treat session_id and user_id as untrusted inputs that must be strictly encoded and validated.
  • Constructs URLs by string concatenation, enabling query parameter injection.
  • Uses X-User-Id as a standalone indicator of identity without cryptographic protection, contextual verification, or binding to a session.

This behavior maps to CWE-287 (Improper Authentication) because the terminal backend effectively accepts identity assertions without robust verification, and to CWE-290 (Authentication Bypass by Spoofing) since an attacker can spoof another user's identity through manipulated parameters and headers.

Potential impact

  • An attacker may impersonate another user when accessing terminal backends.
  • Terminal sessions could be resolved under the wrong user identity, leading to unauthorized access to commands or data.
  • Audit logs and accountability mechanisms can be corrupted, misattributing actions to the wrong user.
  • Depending on deployment, attackers could gain access to sensitive system resources exposed via terminals under higher-privileged accounts.

General mitigation guidance

Effective mitigation focuses on hardening identity propagation and eliminating trust in client-controlled identity hints:

  • Treat all query parameters and headers related to identity (user_id, X-User-Id, session_id) as untrusted and validate them against server-side session state.
  • Use structured URL builders and parameter encoding instead of string concatenation to construct upstream URLs, preventing query injection.
  • Bind user identity to a server-issued, integrity-protected token or session object that the terminal backend validates, rather than trusting raw IDs.
  • Enforce strict authentication and authorization checks at the terminal backend layer, ensuring it verifies the caller's identity independently or via signed/securely propagated claims.
  • Apply least-privilege principles to terminal access, limiting which users and roles can reach sensitive terminal backends.

How teams detect issues like this

Organizations can detect similar vulnerabilities through a combination of review and automated checks:

  • Static analysis rules that flag direct string concatenation when building URLs with user-controlled data, especially when parameters resemble user_id, session, or identity headers.
  • Code review checklists that require identity headers (e.g., X-User-Id) to be either cryptographically bound to a token or derived solely from trusted server-side state.
  • Security tests and fuzzing that attempt query parameter injection against terminal or proxy endpoints, observing whether user identities can be altered.
  • Runtime monitoring and logging to detect anomalies such as identity changes within a single connection or inconsistent combinations of session identifiers and user IDs.
  • Use of automated application security testing tools that specifically look for improper authentication and header-based identity spoofing patterns.

Sources

SourceLink
github.comgithub.com/open-webui/open-webui/commit/5f3a628a8d291bb5d33e1a0b0c89fb62a2927934
github.comgithub.com/open-webui/open-webui/pull/26042
github.comgithub.com/open-webui/open-webui/releases/tag/v0.10.0
github.comgithub.com/open-webui/open-webui/security/advisories/GHSA-j657-m4c4-24jq

Frequently asked

questions

Yes. Any user or client that can reach the affected terminal endpoints and control the relevant query parameters or headers can potentially attempt exploitation, subject to how the deployment exposes the interface.

Not necessarily. Exploitation typically requires the ability to initiate terminal connections with crafted parameters. If standard users can access terminals, they may be able to impersonate higher-privileged identities, depending on additional authorization checks.

The robust fix pattern is to stop trusting client-supplied identity indicators directly. Instead, derive user identity solely from authenticated, server-side session state and propagate it using integrity-protected mechanisms (such as signed tokens) that the terminal backend verifies. All URLs and parameters should be constructed via safe encoding APIs, not manual concatenation.

Adopt a consistent identity propagation model where:

  • Authentication is centralized and identity is encapsulated in securely issued tokens or session objects.
  • Backend services never trust raw IDs from headers or query parameters without verification.
  • Security reviews explicitly cover proxy and terminal-routing components, focusing on header handling, URL construction, and parameter encoding.
  • Automated tests and linters enforce safe URL construction and flag direct use of user-controlled values in authentication decisions.
Find out what's already
exploitable in your codebase.