CVE-2026-21873

Zero-click XSS in all NiceGUI apps which uses `ui.sub_pages`

Published Jan 8, 2026 CVSS 3.1 · 7.2 High EPSS < 1% KEV · Not listed
Description
NiceGUI is a Python-based UI framework. From versions 2.22.0 to 3.4.1, an unsafe implementation in the pushstate event listener used by ui.sub_pages allows an attacker to manipulate the fragment identifier of the URL, which they can do despite being cross-site, using an iframe. This issue has been patched in version 3.5.0.

Analysis

AI-generated

Technical impact

NiceGUI, a Python UI framework, contains an unsafe pushstate event listener used by ui.sub_pages. The listener incorrectly handles changes to the fragment identifier of the URL. An attacker can exploit this flaw by loading the application in a cross‑site iframe and manipulating the fragment without user interaction. The result is a zero‑click XSS vulnerability that can inject arbitrary script into the victim’s browser, enabling session hijacking, credential theft, or defacement of the application.

Affected Systems

Applications built with Zauberzeug NiceGUI versions from 2.22.0 up to 3.4.1 that use ui.sub_pages are affected. All such deployments are vulnerable regardless of the host or domain, as the flaw resides in the framework’s client‑side code.

Risk and Exploitability

The CVSS score of 7.2 indicates moderate‑to‑high severity. The EPSS score is below 1%, suggesting a low likelihood of widespread exploitation at present, and the vulnerability is not listed in the CISA KEV catalog. However, because the flaw can be triggered without any user interaction from a cross‑site iframe, it is effectively zero‑click and can be executed by remote attackers who control a malicious site. The patch was released in NiceGUI 3.5.0; lacking the fix an attacker can simply craft a malicious page that embeds the target application and sets the fragment identifier to trigger script injection.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade NiceGUI to version 3.5.0 or later to eliminate the fault in the pushstate listener.
  • If an upgrade cannot be performed immediately, remove or disable the use of ui.sub_pages in the application to prevent the vulnerable fragment manipulation.
  • Implement a strict Content Security Policy that disallows inline scripts and unsafe eval features to mitigate the impact of any remaining XSS vectors.

Generated by OpenCVE AI on April 18, 2026 at 07:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-mhpg-c27v-6mxr NiceGUI apps which use `ui.sub_pages` vulnerable to zero-click XSS
History
Type Values Removed Values Added
CPEs cpe:2.3:a:zauberzeug:nicegui:*:*:*:*:*:*:*:*
Type Values Removed Values Added
First Time appeared Zauberzeug
Zauberzeug nicegui
Vendors & Products Zauberzeug
Zauberzeug nicegui
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description NiceGUI is a Python-based UI framework. From versions 2.22.0 to 3.4.1, an unsafe implementation in the pushstate event listener used by ui.sub_pages allows an attacker to manipulate the fragment identifier of the URL, which they can do despite being cross-site, using an iframe. This issue has been patched in version 3.5.0.
Title Zero-click XSS in all NiceGUI apps which uses `ui.sub_pages`
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 7.2, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N'}

Weaknesses
  • CWE-79

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jan 8, 2026, 3:11 PM
Reserved
Jan 5, 2026, 4:44 PM
Status
Analyzed
Published
Jan 8, 2026, 10:15 AM
Modified
Jun 17, 2026, 10:19 AM