Mittel

NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows

  • Veröffentlicht: 08.04.2026
  • Aktualisiert: 11.10.2026 14:17

Summary

The upload filename sanitization introduced in GHSA-9ffm-fxg3-xrhh uses PurePosixPath(filename).name to strip path components. Since PurePosixPath only recognizes forward slashes (/) as path separators, an attacker can bypass this sanitization on Windows by using backslashes (\) in the upload filename.

Applications that construct file paths using file.name (a pattern demonstrated in NiceGUI's bundled examples) are vulnerable to arbitrary file write on Windows.

Details

The sanitization in nicegui/elements/upload_files.py uses:

python
filename = PurePosixPath(upload.filename or '').name

PurePosixPath treats backslashes as literal characters, not path separators:

python
>>> PurePosixPath('..\\..\\secret\\evil.txt').name
'..\\..\\secret\\evil.txt'  # Not stripped!

When this filename is used in a path operation on Windows (e.g., Path('uploads') / file.name), Windows Path interprets backslashes as directory separators, resolving the path outside the intended directory.

Impact

On Windows deployments of NiceGUI applications that use file.name in path construction:

  • Arbitrary file write outside the intended upload directory
  • Potential remote code execution through overwriting application files or placing executables in known locations
  • Data integrity loss through overwriting existing files

Linux and macOS are not affected, as they treat backslashes as literal filename characters.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Python (PyPI) nicegui < 3.10.0 3.10.0

Verweise

CVSS-Wert 5.9/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Schwäche (CWE)
CWE-22
Plattform
Python (PyPI)
Paket
nicegui
Veröffentlicht
08.04.2026
Aktualisiert
11.10.2026 14:17

Quellen und Lizenzen

OSV / GitHub Advisory Database - PYSEC-2026-2234 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-w8wv-vfpc-hw2w - CC BY 4.0

Schwachstellenhistorie: nicegui

Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (17) im Archiv
Einträge insgesamt
17
Erste → letzte
04.2024 05.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Hoch 6
  • Mittel 11

Veröffentlichungen pro Jahr

  1. 2024: 1
  2. 2025: 5
  3. 2026: 11
Schweregrad:
  1. NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows dieser Eintrag
    Mittel · 5.9 CVE-2026-39844 < 3.10.0 3.10.0
  2. Hoch · 7.2 CVE-2026-21873 >= 2.22.0, < 3.5.0 3.5.0
  3. Hoch · 7.5 CVE-2025-21618 < 2.9.1 2.9.1
  4. Hoch · 8.2 CVE-2024-32005 >= 1.4.6, < 1.4.21 1.4.21

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.