CVE-2025-66470: Nicegui Cross-Site Scripting Vulnerability
MODERATECVE-2025-66470 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Nicegui libraries in the PyPI ecosystem. The issue involves nicegui stored/reflected xss in ui.interactive_image via unsanitized svg content. Remediation is available by upgrading affected packages to version 3.4.0.
CVE-2025-66470 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2025-66470
To remediate this vulnerability, upgrade all affected Nicegui dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install nicegui>=3.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show nicegui
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-66470, inspect your installed packages using pip:
pip show nicegui
Analyze the terminal output to locate any version of Nicegui in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.4.0), your application is affected.
Note: The pip show nicegui command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where 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. In Nicegui, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-66470 Affected Nicegui Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nicegui
|
PyPI |
< 3.4.0
|
3.4.0
|
References
Frequently Asked Questions
What is CVE-2025-66470?
Which Nicegui versions are affected?
What version fixes CVE-2025-66470?
Is nicegui affected?
What is the CVSS score of CVE-2025-66470?
What CWE is associated with CVE-2025-66470?
How can I check PyPI dependencies for CVE-2025-66470?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2m4f-cg75-76w2",
"modified" : "2025-12-09T16:32:08Z",
"published" : "2025-12-08T21:30:39Z",
"aliases" : [ "CVE-2025-66470" ],
"summary" : "NiceGUI Stored/Reflected XSS in ui.interactive_image via unsanitized SVG content",
"details" : "### Summary\nA Cross-Site Scripting (XSS) vulnerability exists in the `ui.interactive_image` component of NiceGUI (v3.3.1 and earlier). The component renders SVG content using Vue's `v-html` directive without any sanitization. This allows attackers to inject malicious HTML or JavaScript via the SVG `<foreignObject>` tag.\n\n### Details\nThe vulnerability is located in `nicegui/elements/interactive_image.js`.\nThe component uses the following code to render content:\n```javascript\n<g v-html=\"content\"></g>\n```\nVue's v-html directive renders raw HTML strings into the DOM. If an application allows user-controlled input to be passed to the content property of an interactive image, an attacker can embed a <foreignObject> tag containing malicious scripts, bypassing typical image restrictions.\n\n### PoC\n```python\nfrom nicegui import ui\n\n@ui.page('/')\ndef main():\n ui.label('NiceGUI SVG XSS PoC')\n \n # Standard image loading\n img = ui.interactive_image('[https://picsum.photos/640/360](https://picsum.photos/640/360)')\n \n # Payload: Embeds raw HTML execution inside SVG\n # This executes immediately when the image component is rendered\n img.content = (\n '<foreignObject>'\n '<body xmlns=\"[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)\">'\n '<img src=x onerror=alert(\"XSS-SVG\")>'\n '</body>'\n '</foreignObject>'\n )\n\nui.run()\n```\n\n### Impact\n- Type: Reflected / Stored XSS (depending on data source)\n\n- Severity: Moderate\n\n- Impact: Attackers can inject malicious scripts that execute whenever the image component is rendered or updated. This is particularly dangerous for dashboards or multi-user applications displaying user-generated content or annotations.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "nicegui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.4.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.3.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/zauberzeug/nicegui/security/advisories/GHSA-2m4f-cg75-76w2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66470"
}, {
"type" : "WEB",
"url" : "https://github.com/zauberzeug/nicegui/commit/58ad0b36e19922de16bbc79ea3ddd29851b1a3e3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/zauberzeug/nicegui"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-12-08T21:30:39Z",
"nvd_published_at" : "2025-12-09T01:16:54Z"
}
}