CVE-2026-27156: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in zauberzeug nicegui
NiceGUI is a Python-based UI framework. Prior to version 3.8.0, several NiceGUI APIs that execute methods on client-side elements (`Element.run_method()`, `AgGrid.run_grid_method()`, `EChart.run_chart_method()`, and others) use an `eval()` fallback in the JavaScript-side `runMethod()` function. When user-controlled input is passed as the method name, an attacker can inject arbitrary JavaScript that executes in the victim's browser. Additionally, `Element.run_method()` and `Element.get_computed_prop()` used string interpolation instead of `json.dumps()` for the method/property name, allowing quote injection to break out of the intended string context. Version 3.8.0 contains a fix.
AI Analysis
Technical Summary
CVE-2026-27156 identifies a cross-site scripting (XSS) vulnerability in the NiceGUI framework, a Python-based UI toolkit used to build interactive web interfaces. The vulnerability exists in versions prior to 3.8.0 and involves several APIs that execute client-side methods, including Element.run_method(), AgGrid.run_grid_method(), and EChart.run_chart_method(). These APIs rely on a JavaScript-side runMethod() function that falls back to using eval() when executing methods. When user-controlled input is passed as the method name, an attacker can inject arbitrary JavaScript code that executes in the victim's browser context. Furthermore, Element.run_method() and Element.get_computed_prop() use unsafe string interpolation instead of JSON serialization (json.dumps()) for method and property names, allowing attackers to inject quotes and break out of the intended string context, facilitating script injection. This improper neutralization of input during web page generation corresponds to CWE-79. The vulnerability does not require authentication but does require user interaction to trigger the malicious payload. The CVSS v3.1 score is 6.1 (medium), reflecting network attack vector, low attack complexity, no privileges required, user interaction required, and impacts on confidentiality and integrity with no availability impact. The issue was addressed in NiceGUI version 3.8.0 by removing the unsafe eval() fallback and properly serializing inputs to prevent injection. No known exploits are currently reported in the wild.
Potential Impact
The vulnerability allows attackers to execute arbitrary JavaScript in the context of users' browsers interacting with affected NiceGUI applications. This can lead to theft of sensitive information such as session tokens, credentials, or personal data, unauthorized actions performed on behalf of users, and potential compromise of user accounts or systems. Since NiceGUI is used to build web-based user interfaces, any organization deploying vulnerable versions may expose their users to targeted XSS attacks. The impact is particularly significant for applications handling sensitive data or critical operations. While the attack requires user interaction, the low complexity and network accessibility increase risk. The integrity of data displayed or processed by the application can be compromised, and confidentiality breaches may occur. Availability is not directly affected. Organizations relying on NiceGUI for internal or external web applications may face reputational damage, regulatory compliance issues, and increased risk of further exploitation if attackers leverage this vulnerability as an initial access vector.
Mitigation Recommendations
The primary mitigation is to upgrade all NiceGUI deployments to version 3.8.0 or later, where the vulnerability is fixed by eliminating the unsafe eval() fallback and implementing proper JSON serialization for method and property names. Until upgrades can be applied, organizations should implement strict input validation and sanitization on all user inputs that may be passed to client-side method execution APIs. Employ Content Security Policy (CSP) headers to restrict the execution of unauthorized scripts in browsers. Review and audit any custom code that interacts with NiceGUI APIs to ensure no unsafe dynamic code execution occurs. Additionally, monitor web application logs for suspicious activity indicative of attempted XSS exploitation. Educate developers and administrators about the risks of using eval() and unsafe string interpolation in web applications. Finally, consider deploying web application firewalls (WAFs) with rules to detect and block common XSS attack patterns targeting NiceGUI endpoints.
Affected Countries
United States, Germany, United Kingdom, France, Japan, South Korea, Canada, Australia, Netherlands, Sweden
CVE-2026-27156: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in zauberzeug nicegui
Description
NiceGUI is a Python-based UI framework. Prior to version 3.8.0, several NiceGUI APIs that execute methods on client-side elements (`Element.run_method()`, `AgGrid.run_grid_method()`, `EChart.run_chart_method()`, and others) use an `eval()` fallback in the JavaScript-side `runMethod()` function. When user-controlled input is passed as the method name, an attacker can inject arbitrary JavaScript that executes in the victim's browser. Additionally, `Element.run_method()` and `Element.get_computed_prop()` used string interpolation instead of `json.dumps()` for the method/property name, allowing quote injection to break out of the intended string context. Version 3.8.0 contains a fix.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-27156 identifies a cross-site scripting (XSS) vulnerability in the NiceGUI framework, a Python-based UI toolkit used to build interactive web interfaces. The vulnerability exists in versions prior to 3.8.0 and involves several APIs that execute client-side methods, including Element.run_method(), AgGrid.run_grid_method(), and EChart.run_chart_method(). These APIs rely on a JavaScript-side runMethod() function that falls back to using eval() when executing methods. When user-controlled input is passed as the method name, an attacker can inject arbitrary JavaScript code that executes in the victim's browser context. Furthermore, Element.run_method() and Element.get_computed_prop() use unsafe string interpolation instead of JSON serialization (json.dumps()) for method and property names, allowing attackers to inject quotes and break out of the intended string context, facilitating script injection. This improper neutralization of input during web page generation corresponds to CWE-79. The vulnerability does not require authentication but does require user interaction to trigger the malicious payload. The CVSS v3.1 score is 6.1 (medium), reflecting network attack vector, low attack complexity, no privileges required, user interaction required, and impacts on confidentiality and integrity with no availability impact. The issue was addressed in NiceGUI version 3.8.0 by removing the unsafe eval() fallback and properly serializing inputs to prevent injection. No known exploits are currently reported in the wild.
Potential Impact
The vulnerability allows attackers to execute arbitrary JavaScript in the context of users' browsers interacting with affected NiceGUI applications. This can lead to theft of sensitive information such as session tokens, credentials, or personal data, unauthorized actions performed on behalf of users, and potential compromise of user accounts or systems. Since NiceGUI is used to build web-based user interfaces, any organization deploying vulnerable versions may expose their users to targeted XSS attacks. The impact is particularly significant for applications handling sensitive data or critical operations. While the attack requires user interaction, the low complexity and network accessibility increase risk. The integrity of data displayed or processed by the application can be compromised, and confidentiality breaches may occur. Availability is not directly affected. Organizations relying on NiceGUI for internal or external web applications may face reputational damage, regulatory compliance issues, and increased risk of further exploitation if attackers leverage this vulnerability as an initial access vector.
Mitigation Recommendations
The primary mitigation is to upgrade all NiceGUI deployments to version 3.8.0 or later, where the vulnerability is fixed by eliminating the unsafe eval() fallback and implementing proper JSON serialization for method and property names. Until upgrades can be applied, organizations should implement strict input validation and sanitization on all user inputs that may be passed to client-side method execution APIs. Employ Content Security Policy (CSP) headers to restrict the execution of unauthorized scripts in browsers. Review and audit any custom code that interacts with NiceGUI APIs to ensure no unsafe dynamic code execution occurs. Additionally, monitor web application logs for suspicious activity indicative of attempted XSS exploitation. Educate developers and administrators about the risks of using eval() and unsafe string interpolation in web applications. Finally, consider deploying web application firewalls (WAFs) with rules to detect and block common XSS attack patterns targeting NiceGUI endpoints.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-18T00:18:53.962Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 699e0f3bbe58cf853b2906d6
Added to database: 2/24/2026, 8:51:07 PM
Last enriched: 3/4/2026, 7:02:45 PM
Last updated: 4/10/2026, 6:24:15 AM
Views: 72
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.