Open WebUI vulnerable to Stored XSS via iFrame in citations model
Summary
Manually modifying chat history allows setting thehtml property within document metadata. This causes the frontend to enter a code path that treats document contents as HTML, and render them in an iFrame when the citation is previewed. This allows stored XSS via a weaponised document payload in a chat. The payload also executes when the citation is viewed on a shared chat.Details
The vulnerability stems from how iFrame are implemented here: https://github.com/open-webui/open-webui/blob/6f1486ffd0cb288d0e21f41845361924e0d742b3/src/lib/components/chat/Messages/Citations/CitationModal.svelte#L163-L170 Thehtml attribute can be controlled by a user who manually edits the chat history. Since allow-scripts and allow-same-origin are harcoded here the sandboxing offers essentially no protection.PoC
Create an arbitrary chat with a file upload attached:Edit the response
Before saving, configure the browser to use an HTTP proxy tool (Burp/Caido/ZAP) and intercept the save request. Find the object within the history and then messages objects (not the messages array) that contains the document source.
Add html: true to metadata, update the document to an XSS payload, and forward the request.
Observe the payload is rendered in the iFrame and the javascript executes.
The payload also executes when viewed from a shared version of the chat.
Impact
Any user can create a weaponised chat that can be shared and subsequently used to target other users.Low privilege users are at risk of having their session taken over by a payload that reads their token from local storage and exfiltrates it to an attacker controlled server.
Admins are at risk of exposing the server to RCE via same chain described in https://github.com/advisories/GHSA-w7xj-8fx7-wfch.