6.1medium
NiceGUI apps are vulnerable to XSS which uses `ui.sub_pages` and render arbitrary user-provided links
- Severity
- 6.1medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.34% (higher than 20% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-m7j5-rq9j-6jj9PYSEC-2026-1701
Description
NiceGUI is a Python-based UI framework. From versions 2.22.0 to 3.4.1, an unsafe implementation in the click event listener used by ui.sub_pages, combined with attacker-controlled link rendering on the page, causes XSS when the user actively clicks on the link. This issue has been patched in version 3.5.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| zauberzeug nicegui | >= 2.22.0, < 3.5.0, from 2.22.0 before 3.5.0 | CVE List, NVD |
| nicegui (PyPI) | from 2.22.0 before 3.5.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| PyPA Advisory Database | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
NiceGUI is a Python-based UI framework. From versions 2.22.0 to 3.4.1, an unsafe implementation in the click event listener used by ui.sub_pages, combined with attacker-controlled link rendering on the page, causes XSS when the user actively clicks on the link. This issue has been patched in version 3.5.0.
GitHub Advisory Database
Summary
An unsafe implementation in the click event listener used by ui.sub_pages, combined with attacker-controlled link rendering on the page, causes an XSS when the user actively clicks on the link.
Details
-
On
click, eventuallysub_pages_navigateevent is emitted. https://github.com/zauberzeug/nicegui/blob/59fa9424c470f1b12c5d368985fa36e21fda706b/nicegui/elements/sub_pages.js#L41-L63 -
SubPagesRouter (used by ui.sub_pages), lisnening on
sub_pages_navigate,_handle_navigateruns. https://github.com/zauberzeug/nicegui/blob/59fa9424c470f1b12c5d368985fa36e21fda706b/nicegui/sub_pages_router.py#L18-L22 -
_handle_navigaterunsrun_javascriptwith f-string substitutingself.current_pathwhich is simply surrounded by double-quotes. The string context can be broken out easily.
PoC
The minimal PoC boils down to this:
from nicegui import ui
ui.sub_pages({'/': lambda: ui.link('Go to XSS', '/"+alert(1)+"')})
ui.run()
However, it is more likely that the attack takes place with attacker-controlled input, for which this shows it:
from nicegui import app, ui
ui.sub_pages({'/': lambda: ui.label('Hello, World!')})
ui.textarea('Markdown content').bind_value(app.storage.general, 'markdown_content')
ui.markdown().bind_content_from(app.storage.general, 'markdown_content')
ui.run()
Vulnerable input is [XSS LINK](/"+alert(document.domain)+") (causes double payload execution, though)
Both cases require someone to click on the link.
imageImpact
Any page which uses ui.sub_pages and renders arbitrary links on screen (common case of ui.markdown) is affected.
The impact is low since a click is always required from the user, who can on-hover to discover the sketchy content of the link and stop if well-trained.
Appendix
AI is used safely to judge the CVSS scoring (input is not even provided, just the impact statement).
Please find the results in https://poe.com/s/y5DvyqgtszDGLUuHin1O
Scoring update after manual review
- Scope Changed is more inline with other posted XSS vulnerabilities
- Availability None: No DDoS is possible with this. Site remains performant as ever.
NVD (es)
NiceGUI es un framework de interfaz de usuario (UI) basado en Python. Desde las versiones 2.22.0 hasta la 3.4.1, una implementación insegura en el oyente de eventos de clic utilizado por ui.sub_pages, combinada con la renderización de enlaces controlada por el atacante en la página, causa XSS cuando el usuario hace clic activamente en el enlace. Este problema ha sido parcheado en la versión 3.5.0.
References
| https://github.com/zauberzeug/nicegui/security/advisories/GHSA-m7j5-rq9j-6jj9 | exploit, vendor-advisory, web | |
| https://github.com/zauberzeug/nicegui/releases/tag/v3.5.0 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-21872 | advisory | |
| https://github.com/zauberzeug/nicegui | package | |
| https://pypi.org/project/nicegui | package | |
| https://github.com/advisories/GHSA-m7j5-rq9j-6jj9 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-21872 changed 2026-01-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-m7j5-rq9j-6jj9 changed 2026-07-07 | CC-BY-4.0 |
| NVD | CVE-2026-21872 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2026-1701 changed 2026-07-07 | CC-BY-4.0 |