CVE-2025-66470: NiceGUI Stored/Reflected XSS Vulnerability in ui.interactive_image Component
Summary
CVE-2025-66470: NiceGUI Stored/Reflected XSS in ui.interactive_image via unsanitized SVG content. Affects nicegui versions < 3.4.0. Fixed in 3.4.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
NiceGUI is a Python framework that simplifies the creation of user interfaces for web applications. It allows developers to build interactive applications with ease, leveraging components like buttons, labels, and images. The ui.interactive_image component is designed to display images interactively, but it has a vulnerability that allows for Cross-Site Scripting (XSS) attacks due to unsanitized SVG content rendering.
Vulnerability Detail
A Cross-Site Scripting (XSS) vulnerability exists in the ui.interactive_image component of NiceGUI (v3.3.1 and earlier). This vulnerability arises from the use of Vue's v-html directive to render SVG content without proper sanitization. Attackers can exploit this flaw by injecting malicious HTML or JavaScript through the SVG <foreignObject> tag, which can execute scripts whenever the image component is rendered or updated. This poses a significant risk, especially in applications that display user-generated content or annotations.
How To Fix
Latest published version: 3.18.0 as of 22 Oct 2026
pip install --upgrade "nicegui==3.18.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
3.4.0
This is the first release that contains the fix.
pip install --upgrade "nicegui==3.4.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid using user-controlled input for the content property of the interactive image component. Instead, use static or sanitized content to prevent the injection of malicious scripts. Here is an example of how to set a safe content property:
img.content = '<svg><circle cx="50" cy="50" r="40" fill="red" /></svg>'
Conclusion
The CVE-2025-66470 vulnerability in NiceGUI's ui.interactive_image component poses a significant risk due to its potential for XSS attacks. It is crucial to update to version 3.4.0 or later to mitigate this risk. Additionally, utilizing Vulert can help monitor and alert for such vulnerabilities in your applications.
See every vulnerability recorded for nicegui →
FAQ
The vulnerability is a Cross-Site Scripting (XSS) issue that allows attackers to inject malicious scripts into the application via the ui.interactive_image component.
Versions of NiceGUI up to and including 3.3.1 are affected by this vulnerability.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application against this vulnerability using the Vulert playground without any signup.
The CVSS score of this vulnerability is 6.1, indicating a moderate severity level.
If you cannot update the package right away, implement the suggested workaround by avoiding user-controlled input for the content property of the interactive image component.
References
Related vulnerabilities
Recent vulnerabilities recorded for nicegui.