CVE-2026-21873

7.2 HIGH

📋 TL;DR

This vulnerability in NiceGUI allows attackers to manipulate URL fragment identifiers via cross-site iframe attacks, potentially enabling UI manipulation or client-side attacks. It affects NiceGUI versions 2.22.0 through 3.4.1. Users of affected versions who expose NiceGUI applications to untrusted users are at risk.

💻 Affected Systems

Products:
  • NiceGUI
Versions: 2.22.0 to 3.4.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using ui.sub_pages functionality with pushstate event listeners.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attacker could manipulate the UI to trick users into performing unintended actions, potentially leading to data exposure or unauthorized operations.

🟠

Likely Case

UI manipulation allowing attackers to modify page content or redirect users to malicious sites.

🟢

If Mitigated

Limited impact with proper content security policies and input validation in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires attacker to host malicious iframe targeting vulnerable NiceGUI application.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.5.0

Vendor Advisory: https://github.com/zauberzeug/nicegui/security/advisories/GHSA-mhpg-c27v-6mxr

Restart Required: Yes

Instructions:

1. Update NiceGUI to version 3.5.0 or later using pip: pip install nicegui>=3.5.0
2. Restart your NiceGUI application
3. Verify the update was successful

🔧 Temporary Workarounds

Implement Content Security Policy

all

Add frame-ancestors directive to prevent iframe embedding

Add 'Content-Security-Policy: frame-ancestors 'self';' to HTTP headers

🧯 If You Can't Patch

  • Disable or restrict ui.sub_pages functionality if not required
  • Implement strict input validation and sanitization for URL fragment handling

🔍 How to Verify

Check if Vulnerable:

Check NiceGUI version in Python environment: python -c "import nicegui; print(nicegui.__version__)"

Check Version:

python -c "import nicegui; print(nicegui.__version__)"

Verify Fix Applied:

Verify version is 3.5.0 or higher and test UI functionality with sub_pages

📡 Detection & Monitoring

Log Indicators:

  • Unusual iframe requests to NiceGUI endpoints
  • Multiple fragment identifier manipulations

Network Indicators:

  • Cross-origin iframe requests targeting NiceGUI applications

SIEM Query:

http.url:*nicegui* AND http.referer:*iframe*

🔗 References

📤 Share & Export