Skip to main content

NiceGUI CVE-2025-66469

MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2025-12-09 security-advisories@github.com
6.1
CVSS 3.1 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft URL with closing-tag XSS payload
  2. Delivery
    Lure victim into clicking the link
  3. Exploit
    Break out of injected <style>/<script> context
  4. Execution
    Execute arbitrary JavaScript in victim browser
  5. Impact
    Hijack session or exfiltrate user data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitable only when the NiceGUI application feeds untrusted, attacker-influenced input into ui.add_css, ui.add_scss, or ui.add_sass - for example dynamic theming driven by a URL query parameter, form field, or other user input, as shown in the vendor PoC (?color=...). Apps that pass only static/developer-controlled CSS to these functions are not affected. Exploitation further requires victim user interaction (UI:R): the target must open an attacker-supplied crafted link, and the injected JavaScript runs in that victim's browser session, not on the server. Limiting factors: no attacker authentication is needed (PR:N), but the combination of required developer misuse (non-default usage pattern) plus required victim click meaningfully constrains real-world exploitability. ui.add_scss/ui.add_sass inputs additionally need to break the client-side <script> compilation context via </script>.

Impact

This is a genuine but conditional, moderate-risk issue rather than a top-priority emergency. The CVSS 3.1 base score is 6.1 (Medium) with vector AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - network-reachable, low complexity, no attacker privileges, but requiring victim user interaction (clicking a crafted link), with a scope change reflecting that injected script executes in the victim's browser context. Publicly available exploit code exists (a working PoC is published in the GHSA advisory with a concrete malicious URL), which raises practical risk. However, this is NOT confirmed actively exploited: the CVE is not listed in CISA KEV, so per precision rules the status is 'publicly available exploit code exists' - do not conflate PoC availability with in-the-wild exploitation. No EPSS score was provided in the input, so exploitation-probability signals cannot be compared. The single most important mitigating factor, not captured by the raw CVSS, is that this is a reflected XSS that only becomes exploitable when a developer passes untrusted/user-controlled input into ui.add_css, ui.add_scss, or ui.add_sass (e.g., URL-parameter-driven theming); applications that only pass static CSS to these functions are not affected. Net: a real, confirmed vulnerability with public PoC and an available patch, meriting prompt patching for exposed apps, but its blast radius is gated by both developer misuse and victim interaction, so it is not a widespread automated-exploitation threat.

Exploit ScenarioDerived

A NiceGUI application offers user-customizable theming by passing a URL query parameter into ui.add_css (e.g., ui.add_css(f'.q-btn {{ background-color: {color} }}')). An attacker sends a victim a crafted link such as http://target/?color=red;}</style><img src=x onerror=alert(document.domain)><style>, which closes the generated <style>/<script> context and injects arbitrary HTML/JS. A working proof-of-concept for this exact pattern is published in the GitHub Security Advisory; because the CVSS vector is AV:N/UI:R, exploitation is remote and low-complexity but requires the victim to click the attacker's link.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 19, 2026

Reflected cross-site scripting in NiceGUI 3.3.1 and earlier lets remote unauthenticated attackers inject arbitrary JavaScript through the ui.add_css, ui.add_scss, and ui.add_sass helpers whenever an application passes attacker-influenced input into them - for example a theme color taken from a URL query parameter, as in the vendor's own ?color=... demonstration. Because the helpers interpolate that input directly into a <style> block or a client-side Sass compilation <script> block, a payload containing </style> or </script> breaks out of the intended context; the injected script then executes in the browser of a victim who opens a crafted link (UI:R, scope changed), enabling session/data theft or page defacement at low confidentiality and integrity impact. Publicly available exploit code exists, and EPSS is not a strong signal here, but the attack surface is conditional: only applications that feed untrusted data into these functions are exposed, and no CISA KEV active exploitation is recorded. The issue is fixed in NiceGUI 3.4.0.

RemediationAI

Vendor-released patch: upgrade the nicegui package to version 3.4.0, which escapes < as \u003c in serialized CSS/Sass content and applies styles via a textContent-based addStyle() helper instead of raw tag interpolation (see advisory https://github.com/zauberzeug/nicegui/security/advisories/GHSA-72qc-wxch-74mg and commit https://github.com/zauberzeug/nicegui/commit/a8fd25b7d5e23afb1952d0f60a1940e18b5f1ca8). If an immediate upgrade is not possible, the most effective control is to stop passing untrusted strings into ui.add_css/ui.add_scss/ui.add_sass: validate any dynamic theming value against a strict allowlist (e.g. named colors or a ^#[0-9a-fA-F]{3,8}$ pattern) and reject input containing <, </style> or </script>, with the trade-off that legitimate but free-form CSS customization by end users becomes impossible. Applications that must accept arbitrary CSS should sanitize it server-side before the call (strip all < characters or escape them as \u003c), which mirrors the upstream fix but requires maintaining your own wrapper. A Content-Security-Policy that forbids inline script can blunt payload execution, but NiceGUI's frontend depends heavily on inline scripts, so this will likely break the application unless a nonce-based policy is carefully adopted - test before deploying.

Affected Packages

pypi nicegui fix: 3.4.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

NiceGUI renders its single-page frontend from a head-HTML template and lets Python code push CSS/Sass into the document at runtime. In the vulnerable design, ui.add_css wrapped raw content in f'<style>{content}</style>' and handed it to add_head_html, while ui.add_scss/ui.add_sass emitted a <script> block containing json.dumps(content) that is fed to sass.compileString and then appended to the document head. Both patterns treat the payload as HTML/JS source rather than as data: an injected </style> closes the style element and lets a following <img src=x onerror=...> or <script> run, and an injected </script> terminates the Sass compilation script so arbitrary JavaScript continues parsing - the classic CWE-79 failure to encode output for the context it lands in. The upstream fix (commit a8fd25b7d5e23afb1952d0f60a1940e18b5f1ca8) changes the data flow rather than blacklisting tags: content is serialized with json.dumps and every < is replaced with the \u003c escape, and a new addStyle() helper in index.html assigns the compiled CSS through a <style> element's textContent property. Since the payload never re-enters an HTML parser, tag-breaking sequences lose their meaning, and regression tests (test_add_css_with_script, test_add_scss_with_script) assert that </style></script><script>document.write('XSS')</script> no longer renders.

Know when Nicegui gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
vuln.today AI 6.1 MEDIUM

Network-delivered reflected XSS, low complexity, no attacker privileges (PR:N); victim must click a crafted link (UI:R); script runs in browser context so S:C with limited C/I and no availability impact.

3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

DescriptionCVE.org

NiceGUI is a Python-based UI framework. Versions 3.3.1 and below are vulnerable to Reflected XSS through its ui.add_css, ui.add_scss, and ui.add_sass functions. The functions lack proper sanitization or encoding for the JavaScript context they generate. An attacker can break out of the intended <style> or <script> tags by injecting closing tags (e.g., </style> or </script>), allowing for the execution of arbitrary JavaScript. This issue is fixed in version 3.4.0.

Threat Intelligence Overview

EPSS Score
0.3%
Top 81% exploitable
Prevalence
Medium
popular open-source Python UI library, moderate but not universal production footprint
Exploit
POC
Public exploit code exists
Data Quality
3 sources
Confidence: Low

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

50
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Affected Products (CPE)CVE.org

cpe:2.3:a:zauberzeug:nicegui:*:*:*:*:*:*:*:*
CVE-2025-66645 HIGH POC
7.5 Dec 09

Remote arbitrary file read in NiceGUI versions 3.3.1 and below affects applications that explicitly call App.add_media_f

CVE-2026-25732 HIGH POC
7.5 Feb 06

Path traversal in NiceGUI before 3.7.0 allows remote attackers to write arbitrary files outside intended directories by

CVE-2026-21873 HIGH POC
7.2 Jan 08

NiceGUI versions 2.22.0 through 3.4.1 contain a cross-site DOM-based XSS vulnerability in the pushstate event listener f

CVE-2025-66470 MEDIUM POC
6.1 Dec 09

Stored or reflected cross-site scripting in NiceGUI 3.3.1 and earlier lets an attacker execute arbitrary HTML and JavaSc

CVE-2026-21872 MEDIUM POC
6.1 Jan 08

NiceGUI versions 2.22.0 through 3.4.1 contain a stored cross-site scripting vulnerability in the click event listener of

CVE-2026-21871 MEDIUM POC
6.1 Jan 08

Cross-site scripting (XSS) in NiceGUI versions 2.13.0 through 3.4.1 allows attackers to execute arbitrary JavaScript in

CVE-2026-25516 MEDIUM POC
6.1 Feb 06

Cross-site scripting in NiceGUI's ui.markdown() component allows unauthenticated attackers to inject malicious HTML and

CVE-2026-21874 MEDIUM POC
5.3 Jan 08

NiceGUI versions 2.10.0 through 3.4.1 fail to properly release Redis connections when users open and close browser tabs,

CVE-2026-27156 MEDIUM
6.1 Feb 24

NiceGUI versions prior to 3.8.0 are vulnerable to stored cross-site scripting (XSS) through multiple APIs that improperl

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy