Summary
A broken access control flaw in Open WebUI's /api/chat/completions endpoint allows a user to continue another user's chat session by supplying the victim's chat ID along with their own valid API key.
Under affected versions, the API does not properly enforce per-user ownership of chat sessions, enabling horizontal privilege escalation between users.
Affected context
This issue affects deployments of Open WebUI prior to version 0.9.0 that:
- Expose the
/api/chat/completionsendpoint to authenticated users - Allow users to generate their own API keys for interacting with the platform
- Use chat identifiers that are accepted by the backend without verifying ownership
The vulnerability resides in how the backend associates an authenticated API key with a specific chat and fails to ensure that the chat ID belongs to the requesting user.
Exploit preconditions
- Attack surface: Open WebUI HTTP API (
/api/chat/completions) - Required access: Authenticated user with a valid Open WebUI API key
- Additional prerequisite: Knowledge or guessability of another user's Chat ID
- Trigger point: Issuing a completion request using the attacker's API key but supplying another user's Chat ID
- Why exploitation is possible: The API authorizes based on the presence of a valid API key but does not enforce that the referenced chat resource is owned by the key holder, allowing horizontal privilege escalation.
Why this happens
The root cause is a missing authorization check when binding chat resources to the authenticated principal using the /api/chat/completions endpoint.
Instead of validating that the Chat ID belongs to the user associated with the provided API key, the backend accepts any valid Chat ID, treating it as if it were owned by the caller.
This aligns with CWE-639: Authorization Bypass Through User-Controlled Key, where user-supplied identifiers are trusted without verifying resource ownership or performing fine-grained access control.
Potential impact
- Unauthorized continuation of another user's chat conversation
- Exposure of conversation context and inferred private information through continued interaction
- Manipulation or corruption of another user's conversation history
- Loss of confidentiality for sensitive prompts or responses shared within affected chats
General mitigation guidance
Mitigation typically focuses on enforcing strict resource-level authorization and minimizing trust in client-supplied identifiers.
Common defensive patterns include:
- Binding every chat resource to a specific user identity and verifying that the authenticated principal owns the Chat ID before processing requests
- Using server-side session or ownership checks instead of relying solely on user-supplied chat identifiers
- Generating unguessable, high-entropy identifiers and avoiding any assumption that "knowing an ID" implies permission
- Applying least privilege on API keys so they are limited to the owner's resources only
- Centralizing authorization logic to ensure consistent, reusable policy checks across all endpoints that reference shared resources
How teams detect issues like this
High-level detection approaches include:
- Static and dynamic analysis to locate endpoints where user-controlled identifiers (e.g., Chat IDs) are used to fetch resources without explicit ownership checks
- Code review patterns that flag any authorization logic relying solely on authentication or API key presence, rather than verifying resource ownership
- Logging and monitoring for unusual patterns such as a single user accessing or continuing a large number of distinct Chat IDs
- Implementing authorization middleware or policy-as-code to enforce and audit resource-level permissions across API routes

