AgentbeamBeta
AI agent vulnerability · Open WebUI

CVE-2026-59224: Open WebUI: Terminal proxy forwards a spoofable, integrity-unbound user identity to the upstream (X-User-Id header and ws_terminal session_id query injection)

highCVSS 3.1 8.0GHSA-j657-m4c4-24jq

Open WebUI before 0.10.0 forwards the user's identity to the upstream terminal server in a way an attacker can spoof. On the WebSocket path, an unvalidated session_id lets a normal logged-in user inject a user_id query parameter, so the backend resolves another user's terminal scope. Fixed in 0.10.0.

Published Jul 24, 2026 · Analysis Nov 23, 2026

What an attacker can do

The terminal proxy in backend/open_webui/routers/terminals.py passes the Open WebUI user's identity upstream as a bearer-style claim with no signature. On the HTTP path, proxy_terminal sets an X-User-Id header. An attacker who can reach the upstream another way, such as directly or by SSRF, can forge it.

The WebSocket path needs no such access. ws_terminal puts the session_id path parameter straight into the upstream URL, then appends ?user_id= plus the caller's id. It neither validates nor encodes session_id. An encoded ? or & survives Open WebUI's single decode, and the upstream decodes it again, so an attacker-chosen user_id comes first. The upstream binds the first occurrence.

The effect: a normal authenticated user makes the proxy present another user's identity. On backend-coordinator servers (policy_id) that scope terminal containers by user_id, that reaches the other user's terminal scope. With a known active session id, for example one exposed through a shared chat, the attacker can attach to that user's live shell. The CVSS vector marks scope as changed, with high confidentiality, integrity and availability impact.

Who is affected

pip package open-webui before 0.10.0. The WebSocket variant matters for deployments that use the terminal feature with a backend coordinator that scopes terminals by user. The HTTP variant matters for any upstream that trusts X-User-Id. Check the version:

pip show open-webui

open-webui

Ecosystem
PyPI
Affected
< 0.10.0
Fixed in
0.10.0
Check
pip show open-webui

How to fix it

Upgrade to open-webui 0.10.0:

pip install --upgrade open-webui==0.10.0

The fix (pull request 26042) passes session_id through urllib.parse.quote with safe='', so it is one opaque path segment and the appended user_id is the only query parameter the upstream sees. UUID session ids are unchanged. The PR notes that the lack of integrity binding on the forwarded identity is a separate concern spanning Open WebUI and the terminal server, and is not addressed by this change. The advisory recommends a short-lived signed claim for the identity, verified upstream. Do not expose terminal servers directly; only the proxy should reach them.

How to tell if you were hit

In proxy and terminal server logs, look for WebSocket requests to the terminal route whose session id contains encoded question mark or ampersand characters (%3F, %26), or upstream requests carrying two user_id values. Check for terminal sessions attached by a user who did not create them, and for terminal containers accessed under another user's id. Review who can reach the terminal upstream directly. The sources report no exploitation in the wild.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The terminal proxy in backend/open_webui/routers/terminals.py forwards the Open WebUI user's identity to the upstream terminal server / backend coordinator as an authorization claim, with no cryptographic binding to the session that produced it. The forwarded identity is attacker-influenceable on both proxy paths:

  1. HTTP path (`proxy_terminal`) sets headers['X-User-Id'] = user.id. Upstreams that trust X-User-Id as identity receive it unsigned, so an attacker who can reach the upstream by other means (directly, a compromised peer, SSRF) can spoof it.
  2. WebSocket path (`ws_terminal`) is exploitable through Open WebUI itself, with no "other means" required. It interpolates the path parameter session_id directly into the upstream URL and then appends ?user_id=<caller>:
   upstream_url = f'{ws_base}/p/{policy_id}/api/terminals/{session_id}'
   upstream_url += f'?{urllib.parse.urlencode({"user_id": user.id})}'

session_id is neither validated nor URL-encoded (the HTTP sibling runs _sanitize_proxy_path; this path runs nothing). An encoded ?/& smuggled through session_id survives Open WebUI's single decode and is re-decoded by the upstream, injecting an attacker-chosen user_id ahead of the appended one. Query parsing binds the first occurrence, so the backend coordinator resolves the spoofed user's terminal scope.

Technical Details

The forwarded terminal identity is a bearer-style authorization claim with no integrity binding, and on the WebSocket path it is additionally injectable because session_id is concatenated into the URL without encoding or delimiter validation.

Impact

A normal authenticated user can make the terminal proxy present another user's identity to the upstream backend coordinator. On backend coordinator-backed (policy_id) servers that scope terminal containers by user_id, this reaches another user's terminal scope; combined with a known active session ID (for example a chat-scoped session ID surfaced through a shared chat), it allows attaching to that user's live PTY. The HTTP-path variant additionally allows identity spoofing at the upstream tier for any deployment whose upstream trusts X-User-Id.

Appendix: Affected code

  • backend/open_webui/routers/terminals.py — proxy_terminal sets headers['X-User-Id'] = user.id with no signature.
  • backend/open_webui/routers/terminals.py — ws_terminal builds the upstream URL from an unvalidated, unencoded session_id and appends user_id as a query parameter, allowing query injection.

Appendix: Consolidation

Per the Report Handling policy, this consolidates independent reports of the same root cause (the forwarded terminal identity is spoofable / not integrity-bound) into the earliest filing:

  • @smoke-wolf (earliest filing) — the X-User-Id HTTP-path identity is forwarded without integrity binding, spoofable where the upstream trusts the header.
  • @rexpository — the ws_terminal session_id query-injection vector, proving the forwarded user_id is spoofable through the Open WebUI proxy itself, with no "reach the upstream by other means" precondition.

Appendix: Recommended fix

  • Validate and URL-encode session_id before building the upstream URL (urllib.parse.quote(session_id, safe=""); reject ?, #, &, /, %, backslash, control characters). Build the query string with a URL builder so attacker-controlled path content cannot precede it.
  • Bind the forwarded identity instead of passing a raw user_id / X-User-Id: emit a short-lived signed claim (for example HS256 over {uid, iat, aud:server_id} with a key shared only with the specific upstream) and verify it upstream.

Credited to smoke-wolf, rexpository, Classic298.

Questions

Does CVE-2026-59224 require network access to the terminal server?

Not for the WebSocket path. A normal authenticated Open WebUI user can inject user_id through session_id. Only the HTTP header path needs another route to the upstream.

Does 0.10.0 sign the forwarded identity?

No. The fix pull request encodes session_id. It says the unsigned forwarded identity is a related issue spanning Open WebUI and the upstream, and is not addressed by that change.

What does an attacker get?

Access to another user's terminal scope on backend-coordinator servers that key containers by user_id. With a known active session id, they can attach to that user's live shell.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Open WebUI vulnerabilities

All Open WebUI entries