[GH-ISSUE #21858] issue: XSS attack vector #58260

Closed
opened 2026-05-05 22:43:08 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Mywk on GitHub (Feb 25, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21858

Issue

HTML output is escaped in chat but rendered in the completion notification, creating inconsistent sanitization behavior and a potential XSS vector.

Environment

  • Open WebUI: v0.8.3
  • Installation: Docker
  • OS: OpenSUSE Tumbleweed

Expected Behavior

Chat messages and completion notifications should use the same sanitization/rendering logic.

  • If HTML is blocked in chat for security, it must also be escaped in the notification.
  • If HTML rendering is allowed, it must be consistently sanitized in both places.

Actual Behavior

  • In chat, raw HTML (e.g. <table>...</table>) is escaped and shown as literal text.
  • In the completion notification ("finished generating" toast), the same HTML is rendered as formatted output.

This indicates inconsistent rendering/sanitization paths and creates a potential XSS attack surface.

Partially related: #9807 (HTML not rendered in chat).

Steps to Reproduce

  1. Start a new chat in Open WebUI (tested with glm-ocr).
  2. Prompt the model to output raw HTML, for example:
    Convert this data to an HTML table and output only <table>...</table>.
  3. Observe that in the chat window, the HTML is escaped and displayed as text.
  4. Observe the completion notification preview.
  5. The notification renders the HTML instead of escaping it.

Screenshots

Image Image
Originally created by @Mywk on GitHub (Feb 25, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21858 ## Issue HTML output is escaped in chat but rendered in the completion notification, creating inconsistent sanitization behavior and a potential XSS vector. ## Environment * **Open WebUI:** v0.8.3 * **Installation:** Docker * **OS:** OpenSUSE Tumbleweed ## Expected Behavior Chat messages and completion notifications should use the same sanitization/rendering logic. * If HTML is blocked in chat for security, it must also be escaped in the notification. * If HTML rendering is allowed, it must be consistently sanitized in both places. ## Actual Behavior * In chat, raw HTML (e.g. `<table>...</table>`) is escaped and shown as literal text. * In the completion notification ("finished generating" toast), the same HTML is rendered as formatted output. This indicates inconsistent rendering/sanitization paths and creates a potential XSS attack surface. Partially related: #9807 (HTML not rendered in chat). ## Steps to Reproduce 1. Start a new chat in Open WebUI (tested with `glm-ocr`). 2. Prompt the model to output raw HTML, for example: `Convert this data to an HTML table and output only <table>...</table>.` 3. Observe that in the chat window, the HTML is escaped and displayed as text. 4. Observe the completion notification preview. 5. The notification renders the HTML instead of escaping it. ## Screenshots <img width="1047" height="509" alt="Image" src="https://github.com/user-attachments/assets/5b4a7929-3852-47b8-9ac8-9e7bb2af2efa" /> <img width="389" height="195" alt="Image" src="https://github.com/user-attachments/assets/10e837b5-40a3-4e83-8b9e-7c85a5cb1a30" />
GiteaMirror added the bug label 2026-05-05 22:43:08 -05:00
Author
Owner

@Classic298 commented on GitHub (Feb 25, 2026):

  1. Is this still the case in latest version?
  2. Can this be exploited by someone else (besides the user himself)?

If both are yes - file a security case here https://github.com/open-webui/open-webui/security

If no, then this is not a vulnerability.

After all, the model can also create artifacts which render HTML on the side with HTML and CSS and JS and can theoretically do XSS there too. But if the attack vector is "I myself have to tell the model to write that" then that's not an attack vector that's just intended behaviour. If you tell the model to do that, then it will do that.

The fact alone that the notifications are rendered differently doesn't constitute an XSS vulnerability.

Please check our security vulnerability requirements at https://github.com/open-webui/open-webui/security

<!-- gh-comment-id:3958160606 --> @Classic298 commented on GitHub (Feb 25, 2026): 1) Is this still the case in latest version? 2) Can this be exploited by someone else (besides the user himself)? If both are yes - file a security case here https://github.com/open-webui/open-webui/security If no, then this is not a vulnerability. After all, the model can also create artifacts which render HTML on the side with HTML and CSS and JS and can theoretically do XSS there too. But if the attack vector is "I myself have to tell the model to write that" then that's not an attack vector that's just intended behaviour. If you tell the model to do that, then it will do that. The fact alone that the notifications are rendered differently doesn't constitute an XSS vulnerability. Please check our security vulnerability requirements at https://github.com/open-webui/open-webui/security
Author
Owner

@Mywk commented on GitHub (Feb 25, 2026):

Same behavior on latest version. I tested several payloads and no JavaScript was executed, so it does not appear to cross a security boundary under the default configuration.

One question though: if self-XSS via model output is considered expected behavior, what makes issue #9807 different? In both cases the model outputs HTML at the user's request and here it is simply rendered inconsistently between chat and notification, with the notification literally rendering the table.

If this behavior is intended and properly sanitized, feel free to close the issue.

Image
<!-- gh-comment-id:3958251689 --> @Mywk commented on GitHub (Feb 25, 2026): Same behavior on latest version. I tested several payloads and no JavaScript was executed, so it does not appear to cross a security boundary under the default configuration. One question though: if self-XSS via model output is considered expected behavior, what makes issue #9807 different? In both cases the model outputs HTML at the user's request and here it is simply rendered inconsistently between chat and notification, with the notification literally rendering the table. If this behavior is intended and properly sanitized, feel free to close the issue. <img width="1283" height="499" alt="Image" src="https://github.com/user-attachments/assets/b997439e-a033-4919-b184-ec37d7c3eb84" />
Author
Owner

@Classic298 commented on GitHub (Feb 25, 2026):

@Mywk i cannot definitely answer that question since the issue you reference is very old and the codebase around html rendering and JS execution likely looked different back then.

CC @tjbck

<!-- gh-comment-id:3958317158 --> @Classic298 commented on GitHub (Feb 25, 2026): @Mywk i cannot definitely answer that question since the issue you reference is very old and the codebase around html rendering and JS execution likely looked different back then. CC @tjbck
Author
Owner

@Mywk commented on GitHub (Feb 25, 2026):

No worries, updated everything on my end and made a proper issue for the rendering inconsistency. Thank you!

<!-- gh-comment-id:3958349271 --> @Mywk commented on GitHub (Feb 25, 2026): No worries, updated everything on my end and made a proper issue for the rendering inconsistency. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58260