Summary
Open WebUI rendered content from previewed terminal ports in a same-origin iframe sandbox that permitted both scripts and same-origin access. An authenticated user with access to a shared terminal server could host malicious script that may execute when another user opens the preview, potentially leading to account takeover.
Affected context
The vulnerability occurs in Open WebUI deployments that provide terminal port previews and render the proxied content through the chat file navigation interface. Risk exists when an attacker can access a shared terminal server, publish content on a previewed port, and cause or persuade another authenticated user to open that preview while the content remains associated with the Open WebUI origin.
Exploit preconditions
- Attack surface: Terminal port preview functionality in the Open WebUI web interface
- Required access: Authenticated access to a shared terminal server or another capability that allows hosting content on a previewed port
- Victim condition: A second authenticated user must open the affected terminal preview
- Trigger point: Rendering the terminal port content inside the preview iframe
- Why exploitation is possible: The iframe permits both script execution and same-origin access while the proxied content is served from the Open WebUI origin
Why this happens
The underlying issue is an unsafe combination of iframe sandbox permissions for untrusted, attacker-influenced content. Allowing both allow-scripts and allow-same-origin can weaken the isolation expected from a sandbox, particularly when the framed resource is served under the same origin as the parent application. This maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled content can execute script in a trusted application context, and also relates to CWE-1021: Improper Restriction of Rendered UI Layers or Frames.
Potential impact
- A malicious script may execute in the victim's browser context
- An attacker could potentially access or modify account-associated application data
- Victim sessions or account functionality may be compromised
- Other users of shared terminal infrastructure could be targeted through crafted previews
- The issue could facilitate unauthorized actions performed through the victim's active session
General mitigation guidance
Mitigation generally focuses on isolating previewed content from the application trust boundary and preventing attacker-controlled markup from executing with application privileges.
Common defensive patterns include:
- Serve terminal previews from a distinct, non-privileged origin
- Avoid combining
allow-scriptsandallow-same-originfor untrusted framed content - Apply the narrowest iframe sandbox permissions required by the feature
- Use restrictive Content Security Policy controls for preview responses
- Treat shared terminal output and hosted content as untrusted input
- Enforce output encoding and content-type controls where HTML rendering is not required
- Ensure session cookies and privileged browser APIs are not exposed to preview origins
- Apply authorization checks and least privilege to shared terminal resources
How teams detect issues like this
Organizations can assess for this class of issue through:
- Static analysis and code review rules for iframe elements that combine script execution with same-origin access
- Inventory of endpoints that proxy or render user-controlled content under a trusted application origin
- Browser security testing that verifies preview content cannot access parent application data
- Policy checks for cross-origin isolation, restrictive sandbox attributes, and preview-specific Content Security Policy headers
- Dynamic tests using benign marker content to confirm that scripts in previews cannot execute with application-origin privileges
- Automated security review tools that flag unsafe iframe configurations and reflected or stored script execution paths

