NiceGUI
CVE-2025-66469
MEDIUM
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft URL with closing-tag XSS payload
-
DeliveryLure victim into clicking the link
-
ExploitBreak out of injected <style>/<script> context
-
ExecutionExecute arbitrary JavaScript in victim browser
-
ImpactHijack 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
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
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
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.
Primary rating from Vendor (github).
CVSS VectorVendor: github
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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
Remote arbitrary file read in NiceGUI versions 3.3.1 and below affects applications that explicitly call App.add_media_f
Path traversal in NiceGUI before 3.7.0 allows remote attackers to write arbitrary files outside intended directories by
NiceGUI versions 2.22.0 through 3.4.1 contain a cross-site DOM-based XSS vulnerability in the pushstate event listener f
Stored or reflected cross-site scripting in NiceGUI 3.3.1 and earlier lets an attacker execute arbitrary HTML and JavaSc
NiceGUI versions 2.22.0 through 3.4.1 contain a stored cross-site scripting vulnerability in the click event listener of
Cross-site scripting (XSS) in NiceGUI versions 2.13.0 through 3.4.1 allows attackers to execute arbitrary JavaScript in
Cross-site scripting in NiceGUI's ui.markdown() component allows unauthenticated attackers to inject malicious HTML and
NiceGUI versions 2.10.0 through 3.4.1 fail to properly release Redis connections when users open and close browser tabs,
NiceGUI versions prior to 3.8.0 are vulnerable to stored cross-site scripting (XSS) through multiple APIs that improperl
NVD
CVE.org
EPSS
GitHub
Exploit-DB