Summary
Open WebUI versions prior to 0.6.44 contain a stored cross-site scripting (XSS) vulnerability where manually edited chat history can inject arbitrary content into an iframe embed.
Because the iframe is sandboxed with allow-scripts and allow-same-origin, and the configuration for disabling same-origin is ignored, attacker-controlled scripts can execute in the context of the Open WebUI origin when the chat or its shared link is viewed.
Affected context
This vulnerability affects Open WebUI deployments that:
- Allow users (or administrators) to manually modify chat history data, including response message properties such as
embeds - Render the
embedsproperty inside aniframeelement - Use an
iframesandbox configuration that includesallow-scriptsandallow-same-origin
It becomes relevant when chat content, including modified history, is rendered in either the standard chat interface or a "shared" chat view that can be accessed via a shareable link by other users of the instance.
Exploit preconditions
- Attack surface: Web UI rendering of chat messages and shared chat views.
- Required access: Ability to modify chat history data, including setting the
embedsproperty on a response message (e.g., via local storage, database access, or internal tools that allow manual editing). - Trigger point: Viewing of the affected chat or any shared link that renders the compromised message; the browser loads the
embedscontent into aniframewith a permissive sandbox. - Why exploitation is possible: The application loads untrusted, user-controlled
embedsdata into aniframewhose sandbox incorrectly allows both scripts and same-origin behavior, and it does not consistently honor the configuration option intended to restrictallow-same-origin. This combination permits attacker-supplied JavaScript to run with access to the Open WebUI origin.
Why this happens
The core issue is improper neutralization of user-controlled data before it is executed in a browser context, consistent with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
Conceptually, the application:
- Treats the
embedsproperty of a chat response as display content rather than untrusted input. - Injects that content into an
iframewhose sandbox includesallow-scriptsandallow-same-origin, effectively creating an execution environment with the same origin as the main application. - Ignores or overrides a configuration meant to control the
allow-same-originbehavior, weakening the expected isolation model.
This pattern represents a failure to maintain strong separation between untrusted, user-editable content and the active scripting context of the web application, allowing code execution where only inert data should be handled.
Potential impact
- Execution of arbitrary JavaScript in the context of the Open WebUI origin.
- Theft or exfiltration of sensitive data accessible to the web application (e.g., session information, model outputs, chat contents).
- Impersonation of the victim user by performing actions on their behalf within the application UI.
- Persistence of malicious payloads in chat histories that affect any user who views the compromised chat or its shared link.
- Potential pivot to attack other browser-integrated services (e.g., browser extensions or local resources) depending on the victim's environment.
General mitigation guidance
Effective mitigation focuses on treating all user-controllable data as untrusted and isolating it from active scripting contexts:
- Constrain iFrame Capabilities:
- Avoid combining
allow-scriptswithallow-same-originfor frames that can load user-controlled content. - Prefer a sandbox policy that either disallows scripts entirely, or ensures untrusted content is hosted on a distinct, locked-down origin (e.g., a separate domain or subdomain).
- Validate and Sanitize Embed Data:
- Apply strict allowlists for which properties and URLs can be used in
embeds. - Reject or strip script-like constructs, JavaScript URLs, inline event handlers, and other active content from embed fields.
- Honor Security Configuration by Default:
- Ensure that configuration flags controlling iframe sandbox options are consistently enforced in code paths that render
embeds. - Default configurations should favor the most restrictive safe behavior and require explicit opt-in for more permissive sandboxing.
- Limit Manual Data Editing:
- Restrict manual modification of chat history to trusted operators and log changes to detect misuse.
- Where possible, expose only high-level administration APIs that enforce validation, rather than allowing arbitrary low-level data manipulation.
- Apply Principle of Least Privilege in the Frontend:
- Minimize the exposure of sensitive APIs to the rendering frame.
- Avoid storing long-lived or highly privileged tokens in browser-accessible storage when possible.
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behaviors:
- Static Analysis & Code Scanning:
- Flag uses of
iframeelements where: - The
sandboxattribute combinesallow-scriptswithallow-same-origin, and - The
srcor inner document is derived from user-controlled or modifiable data (such asembedsin chat messages). - Identify template or JSX patterns where raw, unsanitized content is assigned into HTML containers (e.g.,
dangerouslySetInnerHTMLor direct DOM APIs).
- Targeted Code Review:
- Review all code paths that deserialize or load chat history or embed data, especially where "manual edit" or admin tooling exists.
- Check alignment between security-related configuration options (e.g., "iframe Sandbox Allow Same Origin") and actual runtime behavior of iframe construction.
- Runtime Monitoring & Logging:
- Log when chats are exported, imported, or manually edited; look for unusual or scripted content in embed fields.
- Implement Content Security Policy (CSP) reporting endpoints to surface script executions originating from unexpected locations.
- Automated Tooling:
- Use web security scanners or automated UI tests that attempt to inject benign script markers into chat message fields and detect whether they execute.
- Integrate these checks into CI/CD pipelines to guard against regressions when modifying the chat rendering layer.

