{"id":1253,"cve":"CVE-2025-21618","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2025-21618\/","cwe":"CWE-287","cwe_number":287,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/287","cvss_score":7.5,"published":"2025-01-06","owasp":"A07 Identification and Authentication Failures","odc":"Interface","cdc":"Incorrect Functionality","category":"Authentication, Authorization, and Session Management","subcategory":"Session Management Issues","scope":"Remote","impact":"Unauthorized Access","summary":"NiceGUI auth bypass: Login persisted across browsers, including incognito mode.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2025-21618\/","description":"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.","solution":"Upgrade to version 2.9.1.","affected_component":"NiceGUI","fixed_by_upgrading":true,"vulnerable_code":"from nicegui import ui, app\n\n@ui.page('\/')\ndef index():\n    if 'user' not in app.storage.user:\n      ui.label('Not logged in')\n      with ui.row():\n        username = ui.input(label=\"Username\")\n        password = ui.input(label=\"Password\", password=True)\n        ui.button(\"Login\", on_click=lambda: login(username.value, password.value))\n    else:\n        ui.label(f\"Logged in as {app.storage.user['user']}\")\n        ui.button(\"Logout\", on_click=logout)\n\ndef login(username, password):\n    if username == \"test\" and password == \"test\":\n        app.storage.user['user'] = username\n        ui.notify(\"Logged in successfully\")\n    else:\n        ui.notify(\"Invalid credentials\", color='negative')\n\n    \ndef logout():\n    app.storage.user.clear()\n    ui.notify(\"Logged out\")\n    \n\nui.run(storage_secret='my_secret')","patched_code":"from nicegui import ui, app\n\n@ui.page('\/')\ndef index():\n    if 'user' not in app.storage.user:\n        ui.label('Not logged in')\n        with ui.row():\n            username = ui.input(label=\"Username\")\n            password = ui.input(label=\"Password\", password=True)\n            ui.button(\"Login\", on_click=lambda: login(username.value, password.value))\n    else:\n        ui.label(f\"Logged in as {app.storage.user['user']}\")\n        ui.button(\"Logout\", on_click=logout)\n\ndef login(username, password):\n    if username == \"test\" and password == \"test\":\n        app.storage.user['user'] = username\n        ui.notify(\"Logged in successfully\")\n    else:\n        ui.notify(\"Invalid credentials\", color='negative')\n\n    \ndef logout():\n    app.storage.user.clear()\n    ui.notify(\"Logged out\")\n\nui.run(storage_secret='my_secret', secure_storage=True)\n","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[{"repository":"zauberzeug\/nicegui","commit_url":"https:\/\/github.com\/zauberzeug\/nicegui\/commit\/343dc0da8de0cf2f645cf8b5d76f5b439cb817f3","commit_subject":"clear client cookies after reach response to prevent httpx internal cookie persistence to leak from one On Air request into another","units":[{"file":"nicegui\/air.py","function":"Air.__init__"}]}],"references":null}