Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-27156

CVE-2026-27156: Zauberzeug Nicegui XSS Vulnerability

CVE-2026-27156 is a cross-site scripting flaw in Zauberzeug Nicegui that allows attackers to inject malicious JavaScript through eval() fallbacks. This article covers technical details, affected versions, and mitigation steps.

Published: February 27, 2026

CVE-2026-27156 Overview

NiceGUI is a Python-based UI framework that enables developers to create web interfaces using Python code. Prior to version 3.8.0, several NiceGUI APIs that execute methods on client-side elements—including 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.

Critical Impact

Attackers can execute arbitrary JavaScript in victim browsers through malicious method names, potentially leading to session hijacking, credential theft, and unauthorized actions on behalf of authenticated users.

Affected Products

  • Zauberzeug NiceGUI versions prior to 3.8.0

Discovery Timeline

  • 2026-02-24 - CVE CVE-2026-27156 published to NVD
  • 2026-02-26 - Last updated in NVD database

Technical Details for CVE-2026-27156

Vulnerability Analysis

This Cross-Site Scripting (XSS) vulnerability exists in the NiceGUI framework's method execution architecture. The framework allows Python code to call JavaScript methods on client-side UI elements through functions like Element.run_method(). The vulnerable code path involves a JavaScript runMethod() function that attempts to locate and execute the specified method on target elements. When the method name isn't found as a direct property of the element, the code falls back to using eval() to execute the method name as arbitrary JavaScript code.

The vulnerability is compounded by improper string handling in the Python-side code. The Element.run_method() and Element.get_computed_prop() functions used Python f-string interpolation to embed the method name directly into the JavaScript string, rather than properly serializing it with json.dumps(). This allowed attackers to inject quote characters that break out of the string context, enabling arbitrary code execution even before reaching the eval() fallback.

Root Cause

The root cause is twofold: First, the use of eval() as a fallback mechanism in the JavaScript runMethod() function when a method name is not found on the target element. Second, improper input sanitization where method names were embedded using string interpolation (f'return runMethod({self.id}, "{name}", {json.dumps(args)})') instead of proper JSON serialization. This combination allows user-controlled method names to escape the string context and execute arbitrary JavaScript in the victim's browser.

Attack Vector

An attacker can exploit this vulnerability by supplying a malicious method name containing JavaScript code to any NiceGUI application that passes user-controlled input to element method execution functions. The attack is network-based and requires user interaction—the victim must visit a page containing the malicious payload or interact with a component that triggers the vulnerable code path. Due to the changed scope, successful exploitation can impact resources beyond the vulnerable component's security context.

python
# Vulnerable code pattern (Python side)
# Source: https://github.com/zauberzeug/nicegui/commit/1861f59cc374ca0dc9d970b157ef3774720f8dbf

         """
         if not core.loop:
             return NullResponse()
-        return self.client.run_javascript(f'return runMethod({self.id}, "{name}", {json.dumps(args)})', timeout=timeout)
+        return self.client.run_javascript(
+            f'return runMethod({self.id}, {json.dumps(name)}, {json.dumps(args)})', timeout=timeout,
+        )

     def get_computed_prop(self, prop_name: str, *, timeout: float = 1) -> AwaitableResponse:
         """Return a computed property.
javascript
// Vulnerable code pattern (JavaScript side) - eval() fallback removed
// Source: https://github.com/zauberzeug/nicegui/commit/1861f59cc374ca0dc9d970b157ef3774720f8dbf

   if (typeof target === "object") {
     if (method_name in target) {
       return target[method_name](...args);
-    } else {
-      return eval(method_name)(target, ...args);
     }
-  }
-  const element = getElement(target);
-  if (element === null || element === undefined) return;
-  if (method_name in element) {
-    return element[method_name](...args);
-  } else if (method_name in (element.$refs.qRef || [])) {
-    return element.$refs.qRef[method_name](...args);
   } else {
-    return eval(method_name)(element, ...args);
+    const element = getElement(target);
+    if (element === null || element === undefined) return;
+    if (method_name in element) {
+      return element[method_name](...args);
+    } else if (method_name in (element.$refs.qRef || [])) {
+      return element.$refs.qRef[method_name](...args);
+    }
+  }
+  let msg = `Method "${method_name}" not found.`;
+  if (method_name.includes("=>") || method_name.startsWith("(")) {
+    msg += " To run arbitrary JavaScript, use ui.run_javascript() instead.";
   }
+  logAndEmit("error", msg);
 }

Detection Methods for CVE-2026-27156

Indicators of Compromise

  • Unusual JavaScript execution patterns in browser developer console logs containing eval() calls with user-supplied strings
  • HTTP requests containing JavaScript code fragments in parameters destined for NiceGUI method execution endpoints
  • Browser-side error messages referencing unexpected method names containing arrow functions (=>) or parentheses
  • Session cookie exfiltration attempts or unexpected outbound requests from client browsers

Detection Strategies

  • Implement Content Security Policy (CSP) headers with script-src directives that prevent inline script execution and report violations
  • Monitor web application firewall (WAF) logs for requests containing JavaScript syntax in method name parameters
  • Deploy browser-based monitoring to detect unexpected eval() calls or DOM manipulation patterns
  • Review application logs for method invocation errors with suspicious method names

Monitoring Recommendations

  • Enable CSP reporting to receive notifications of blocked script execution attempts
  • Configure centralized logging for all NiceGUI application server errors and client-side exceptions
  • Implement real-time alerting for patterns consistent with XSS exploitation attempts
  • Monitor for unusual client-side network requests that may indicate data exfiltration

How to Mitigate CVE-2026-27156

Immediate Actions Required

  • Upgrade NiceGUI to version 3.8.0 or later immediately
  • Audit application code for any usage of Element.run_method(), AgGrid.run_grid_method(), EChart.run_chart_method(), or Element.get_computed_prop() with user-controlled input
  • Implement input validation and sanitization for any method names derived from user input
  • Deploy Content Security Policy headers to mitigate potential exploitation of unpatched instances

Patch Information

Zauberzeug has released version 3.8.0 of NiceGUI which addresses this vulnerability. The fix removes the dangerous eval() fallback from the JavaScript runMethod() function and properly serializes method names using json.dumps() on the Python side. The patch is available through the GitHub Commit and details are documented in the GitHub Security Advisory GHSA-78qv-3mpx-9cqq.

Workarounds

  • Avoid passing user-controlled input directly to method execution functions such as run_method(), run_grid_method(), or run_chart_method()
  • Implement an allowlist of permitted method names and validate all input against this list before execution
  • Use ui.run_javascript() directly with properly sanitized inputs when dynamic JavaScript execution is required
  • Deploy strict Content Security Policy headers to limit the impact of any XSS exploitation
bash
# Configuration example - Installing patched version
pip install --upgrade nicegui>=3.8.0

# Verify installed version
pip show nicegui | grep Version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechNicegui

  • SeverityMEDIUM

  • CVSS Score6.1

  • EPSS Probability0.03%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-78qv-3mpx-9cqq
  • Related CVEs
  • CVE-2026-25516: NiceGUI ui.markdown() XSS Vulnerability

  • CVE-2026-21871: NiceGUI XSS Vulnerability

  • CVE-2026-21872: NiceGUI Python Framework XSS Vulnerability

  • CVE-2026-21873: NiceGUI Python Framework XSS Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English