Summary
A stored cross-site scripting (XSS) vulnerability in Open WebUI allows an authenticated user with model creation permissions to embed malicious JavaScript in a model's data.
When other users, including administrators, view the affected model in the chat UI, the injected script can execute in their browsers, potentially compromising their sessions and data.
Affected context
The vulnerability arises in Open WebUI deployments where:
- Multiple users share the same workspace environment
- Users have been granted
workspace.modelsor equivalent model creation permissions - Model definitions, metadata, or associated content are rendered in the chat UI without strict output encoding
The issue manifests when a user with creation privileges stores content that is later rendered as HTML/JavaScript in other users' browsers, without adequate sanitization or escaping.
Exploit preconditions
- Attack surface: Web-based chat UI within Open WebUI.
- Required access: Authenticated account with permission to create or modify models (
workspace.models). - Trigger point: Another user (including admins) opens or interacts with the maliciously crafted model in the chat UI.
- Why exploitation is possible: User-controlled model data is rendered into the DOM without appropriate output encoding or sanitization, allowing embedded script content to execute in the context of the victim's session.
Why this happens
This issue is a classic example of CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
The application takes user-supplied model content (such as names, descriptions, prompts, or other model-related fields) and injects it into HTML pages without consistently applying context-aware output encoding or sanitization.
As a result, untrusted data is interpreted by the browser as active JavaScript rather than inert text, enabling arbitrary script execution whenever other users view the affected model in the chat interface.
Potential impact
- Theft or misuse of authentication cookies or session tokens from affected users' browsers
- Execution of arbitrary actions on behalf of victims within Open WebUI (e.g., changing configurations, creating or deleting resources)
- Exposure or exfiltration of sensitive data displayed or accessible through the UI
- Phishing or social engineering via deceptive UI modifications or overlays
- Potential pivoting to other systems if the UI integrates with additional backend services or APIs
General mitigation guidance
Effective mitigation focuses on systematic output encoding and strict handling of untrusted data:
- Apply context-aware output encoding for all user-controlled fields rendered in the chat UI (e.g., HTML, attribute, JavaScript, and URL contexts).
- Use a robust HTML sanitization layer for rich-text content, allowing only a minimal, whitelisted subset of tags and attributes.
- Separate data from presentation logic by using templating frameworks that auto-escape variables by default.
- Treat all model metadata and user-provided content as untrusted, even when submitted by authenticated users with elevated permissions.
- Implement principle of least privilege for model creation permissions, granting them only where necessary and monitoring usage.
How teams detect issues like this
High-level detection approaches may include:
- Static analysis: Configure rules to identify direct DOM injections (e.g., use of
innerHTML,dangerouslySetInnerHTML, or equivalent APIs) that involve user-controlled model data. - Code review: During reviews, flag any rendering of model names, descriptions, prompts, or other user-editable fields that are inserted into HTML templates without explicit encoding.
- Security testing: Use automated and manual penetration testing to inject benign script markers into model fields and verify whether they are rendered as executable code.
- Logging and monitoring: Monitor for anomalous UI behavior, unexpected DOM changes, or error logs that might indicate active XSS exploitation.

