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-21871

CVE-2026-21871: NiceGUI XSS Vulnerability

CVE-2026-21871 is a cross-site scripting vulnerability in NiceGUI affecting versions 2.13.0 to 3.4.1 when untrusted input is passed to navigation history functions. This post covers technical details, affected versions, and mitigation.

Updated: January 22, 2026

CVE-2026-21871 Overview

CVE-2026-21871 is a Cross-Site Scripting (XSS) vulnerability affecting NiceGUI, a Python-based UI framework. The vulnerability exists in versions 2.13.0 through 3.4.1 and allows attackers to execute arbitrary JavaScript in a victim's browser when developers pass attacker-controlled strings into the ui.navigate.history.push() or ui.navigate.history.replace() functions.

These helper functions are documented as History API wrappers designed to update the browser URL without triggering a page reload. However, when a URL argument is embedded into generated JavaScript without proper escaping, a crafted payload can break out of the intended string context and execute malicious scripts.

Critical Impact

Attackers can execute arbitrary JavaScript in the context of the victim's browser session, potentially leading to session hijacking, credential theft, or malicious content injection.

Affected Products

  • NiceGUI versions 2.13.0 through 3.4.1
  • Applications using ui.navigate.history.push() with untrusted input
  • Applications using ui.navigate.history.replace() with untrusted input

Discovery Timeline

  • 2026-01-08 - CVE CVE-2026-21871 published to NVD
  • 2026-01-08 - Last updated in NVD database

Technical Details for CVE-2026-21871

Vulnerability Analysis

This XSS vulnerability stems from improper input sanitization within NiceGUI's History API wrapper functions. The ui.navigate.history.push() and ui.navigate.history.replace() methods accept URL strings that are subsequently embedded into dynamically generated JavaScript code. Without proper escaping mechanisms, an attacker who controls the input to these functions can craft malicious payloads that escape the intended string context.

When exploited, this vulnerability allows arbitrary JavaScript execution within the victim's browser, operating under the same origin as the vulnerable NiceGUI application. This can compromise user sessions, exfiltrate sensitive data, or perform actions on behalf of authenticated users.

Applications that do not pass untrusted or user-controlled input into these navigation functions remain unaffected by this vulnerability.

Root Cause

The root cause is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation). The vulnerability arises because URL arguments passed to the History API helper functions are embedded into JavaScript code without adequate escaping or sanitization. This allows specially crafted input strings containing JavaScript syntax characters to break out of the string literal context and inject executable code.

Attack Vector

The attack requires user interaction and operates over the network. An attacker must convince a developer-built application to pass a malicious URL string to either ui.navigate.history.push() or ui.navigate.history.replace(). This typically occurs when:

  1. User input is directly passed to these navigation functions without validation
  2. URL parameters or form data are used to construct history entries
  3. External data sources provide URL values that are trusted without sanitization

The payload would include JavaScript escape sequences and code that, when processed by the client's browser, executes outside the intended string context. For technical details on the exploitation mechanism, refer to the GitHub Security Advisory GHSA-7grm-h62g-5m97.

Detection Methods for CVE-2026-21871

Indicators of Compromise

  • Unusual JavaScript execution errors in browser console logs related to History API calls
  • Unexpected URL patterns containing JavaScript syntax characters in application logs
  • Reports of suspicious browser behavior or redirects from application users
  • Network traffic containing encoded JavaScript payloads in URL parameters

Detection Strategies

  • Implement Content Security Policy (CSP) headers with strict script-src directives to detect and block inline script execution
  • Monitor application logs for URL inputs containing suspicious characters such as <, >, ', ", (, ), and encoded variants
  • Use Web Application Firewalls (WAF) with XSS detection rules to identify malicious payloads targeting navigation functions
  • Conduct code reviews to identify all usages of ui.navigate.history.push() and ui.navigate.history.replace() with dynamic input

Monitoring Recommendations

  • Enable verbose logging for all user-supplied inputs that flow into navigation functions
  • Set up alerts for CSP violation reports that may indicate attempted XSS exploitation
  • Monitor client-side error reporting services for JavaScript execution anomalies
  • Track application behavior for unauthorized DOM modifications or unexpected script executions

How to Mitigate CVE-2026-21871

Immediate Actions Required

  • Upgrade NiceGUI to version 3.5.0 or later immediately
  • Audit all application code for usages of ui.navigate.history.push() and ui.navigate.history.replace() with user-controlled input
  • Implement input validation and sanitization for any data passed to navigation functions
  • Deploy Content Security Policy headers to provide defense-in-depth against XSS attacks

Patch Information

The vulnerability has been patched in NiceGUI version 3.5.0. Organizations should upgrade to this version or later to remediate the vulnerability. The patch implements proper escaping for URL arguments before they are embedded into generated JavaScript code.

For detailed release information, see the GitHub Release v3.5.0. Additional security context is available in the GitHub Security Advisory GHSA-7grm-h62g-5m97.

Workarounds

  • Avoid passing user-controlled or untrusted input directly to ui.navigate.history.push() or ui.navigate.history.replace()
  • Implement strict allowlist validation for any URL values before passing them to navigation functions
  • Use URL encoding and sanitization libraries to escape potentially dangerous characters in user input
  • Consider implementing a proxy function that validates and sanitizes URLs before calling the underlying History API methods
bash
# Configuration example - Upgrade NiceGUI to patched version
pip install --upgrade nicegui>=3.5.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
  • Technical References
  • GitHub Release v3.5.0

  • GitHub Security Advisory GHSA-7grm-h62g-5m97
  • Related CVEs
  • CVE-2026-27156: Zauberzeug Nicegui XSS Vulnerability

  • CVE-2026-25516: NiceGUI ui.markdown() 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