CVE-2025-66470: Nicegui Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-2m4f-cg75-76w2
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2025-66470
GHSA Identifier GHSA-2m4f-cg75-76w2
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Nicegui
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

nicegui fixed: 3.4.0
pip install nicegui>=3.4.0
Verify Direct and Transitive Dependencies

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

### Summary A 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. ### Details The vulnerability is located in `nicegui/elements/interactive_image.js`. The component uses the following code to render content: ```javascript <g v-html="content"></g> ``` Vue'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. ### PoC ```python from nicegui import ui @ui.page('/') def main(): ui.label('NiceGUI SVG XSS PoC') # Standard image loading img = ui.interactive_image('[https://picsum.photos/640/360](https://picsum.photos/640/360)') # Payload: Embeds raw HTML execution inside SVG # This executes immediately when the image component is rendered img.content = ( '<foreignObject>' '<body xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">' '<img src=x onerror=alert("XSS-SVG")>' '</body>' '</foreignObject>' ) ui.run() ``` ### Impact - Type: Reflected / Stored XSS (depending on data source) - Severity: Moderate - 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.

CVE-2025-66470 Affected Nicegui Versions

1 component(s)
Fixed Versions:
3.4.0
Product / Package Ecosystem Affected Versions Fixed Version
nicegui
PyPI
< 3.4.0
3.4.0

References

Frequently Asked Questions

What is CVE-2025-66470?
CVE-2025-66470 is a security vulnerability in Nicegui involving NiceGUI Stored/Reflected XSS in ui.interactive_image via unsanitized SVG content under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Nicegui versions are affected?
Affected versions include releases prior to 3.4.0 across affected packages: nicegui.
What version fixes CVE-2025-66470?
Upgrading to 3.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nicegui affected?
Yes, nicegui is affected in releases prior to 3.4.0. Upgrade your dependency to 3.4.0 or later.
What is the CVSS score of CVE-2025-66470?
CVE-2025-66470 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2025-66470?
CVE-2025-66470 is classified under CWE-79: 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.).
How can I check PyPI dependencies for CVE-2025-66470?
Run the dependency tree command: 'pip show nicegui'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}