CVE-2025-21618
NiceGUI auth bypass: Login persisted across browsers, including incognito mode.
- CVSS 7.5
- CWE-287
- Authentication, Authorization, and Session Management
- Remote
NiceGUI is an easy-to-use, Python-based UI framework. Prior to 2.9.1, authenticating with NiceGUI logged in the user for all browsers, including browsers in incognito mode. This vulnerability is fixed in 2.9.1.
- CWE
- CWE-287
- CVSS base score
- 7.5
- Published
- 2025-01-06
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Session Management Issues
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- NiceGUI
- Fixed by upgrading
- Yes
Solution
Upgrade to version 2.9.1.
Vulnerable code sample
from nicegui import ui, app
@ui.page('/')
def index():
if 'user' not in app.storage.user:
ui.label('Not logged in')
with ui.row():
username = ui.input(label="Username")
password = ui.input(label="Password", password=True)
ui.button("Login", on_click=lambda: login(username.value, password.value))
else:
ui.label(f"Logged in as {app.storage.user['user']}")
ui.button("Logout", on_click=logout)
def login(username, password):
if username == "test" and password == "test":
app.storage.user['user'] = username
ui.notify("Logged in successfully")
else:
ui.notify("Invalid credentials", color='negative')
def logout():
app.storage.user.clear()
ui.notify("Logged out")
ui.run(storage_secret='my_secret')Patched code sample
from nicegui import ui, app
@ui.page('/')
def index():
if 'user' not in app.storage.user:
ui.label('Not logged in')
with ui.row():
username = ui.input(label="Username")
password = ui.input(label="Password", password=True)
ui.button("Login", on_click=lambda: login(username.value, password.value))
else:
ui.label(f"Logged in as {app.storage.user['user']}")
ui.button("Logout", on_click=logout)
def login(username, password):
if username == "test" and password == "test":
app.storage.user['user'] = username
ui.notify("Logged in successfully")
else:
ui.notify("Invalid credentials", color='negative')
def logout():
app.storage.user.clear()
ui.notify("Logged out")
ui.run(storage_secret='my_secret', secure_storage=True)Cite this entry
@misc{vaitp:cve202521618,
title = {{NiceGUI auth bypass: Login persisted across browsers, including incognito mode.
}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2025},
note = {VAITP Python Vulnerability Dataset, entry CVE-2025-21618},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-21618/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
