Summary
Open WebUI contained a session mix-up issue where execute:python and execute:tool Socket.IO events were dispatched based solely on a connected session_id, without confirming the requesting user's ownership of that session.
An authenticated user who could learn another user's socket ID via collaborative document features could trigger code interpreter Python or tool execution in the victim's session, effectively hijacking their code execution context.
Affected context
This vulnerability appears when Open WebUI is deployed with:
- The Socket.IO-based code interpreter or tool execution features enabled
- Multiple authenticated users sharing the same instance
- Collaborative or shared features (such as ydoc:document:join) that expose or indirectly reveal other users' session identifiers
The risk is most pronounced in multi-tenant environments where untrusted users can observe or infer other active socket IDs.
Exploit preconditions
- Attack surface: WebSocket / Socket.IO interface of Open WebUI.
- Required access: Authenticated access to the instance and the ability to join or observe collaborative documents that expose other users' session IDs.
- Trigger point: Issuing get_event_call events that carry execute:python or execute:tool actions targeting a victim's session_id.
- Why exploitation is possible: The server checks only that a session_id is connected, but does not verify that the caller owns or controls that session, enabling horizontal privilege misuse.
Why this happens
The core problem is an authorization flaw where session-scoped actions are bound to a client-supplied session_id without strong ownership validation.
This maps primarily to CWE-94: Improper Control of Generation of Code, because the attacker can indirectly cause arbitrary Python code or tool invocations to run in another user's interpreter context.
It is also related to CWE-639 (Insecure Direct Object Reference) and CWE-862 (Missing Authorization) since the design trusts unvalidated identifiers for security decisions across WebSocket events.
Potential impact
- Hijacking another user's code interpreter session to run arbitrary Python code in their context
- Execution of tools or actions as another user, potentially accessing their data or integrations
- Exposure of sensitive information processed or visible within the victim's session
- Lateral movement within a multi-user instance through abuse of shared or collaborative features
General mitigation guidance
Mitigation generally focuses on strengthening session binding and authorization checks for all Socket.IO events.
Common defensive patterns include:
- Ensuring that server-side handlers derive the effective session or user identity from the authenticated connection, not from client-supplied IDs
- Applying strict authorization checks for every event that triggers code execution or tool invocation
- Designing collaborative features so that internal identifiers (such as socket IDs) are not exposed or guessable by other users
- Limiting the capabilities of code interpreter and tools with least-privilege principles, so that compromise of a single session has constrained blast radius
How teams detect issues like this
Detection often relies on reviewing both code and runtime behavior:
- Static or manual code review focusing on WebSocket / Socket.IO handlers that accept client-supplied identifiers for session, user, or room selection
- Authorization-focused tests that attempt to invoke privileged actions against other users' sessions using modified session_id parameters
- Centralized logging of execute:python and execute:tool events, including both authenticated user identity and target session identifiers, to spot cross-user anomalies
- Use of automated application security testing or SAST tools configured to flag missing authorization checks in event-driven handlers

