Hoch

NiceGUI: Local file disclosure via Docutils file insertion in ui.restructured_text()

  • Veröffentlicht: 18.05.2026
  • Aktualisiert: 11.10.2026 14:18

Summary

ui.restructured_text() renders reStructuredText server-side with Docutils without disabling file insertion directives.

When a NiceGUI application passes attacker-controlled content to ui.restructured_text(), an attacker can use standard Docutils directives (include, csv-table with :file:, raw with :file:) to read local files readable by the NiceGUI server process.

Applications that only pass trusted static strings to ui.restructured_text() are not affected.

Details

The affected component is the reStructuredText renderer:

  • File: nicegui/elements/restructured_text.py
  • Function: prepare_content()

prepare_content() renders user-supplied reStructuredText through Docutils:

python
html = publish_parts(
    remove_indentation(content),
    writer_name='html4',
    settings_overrides={'syntax_highlight': 'short'},
)

The Docutils call only sets syntax_highlight. It does not disable file insertion or raw directives, so Docutils processes directives that read local files and embed their contents into the generated HTML before it is returned to the browser. Frontend sanitization cannot prevent this because the file has already been read server-side.

A minimal vulnerable usage pattern is any page that forwards untrusted input into ui.restructured_text(), e.g. content taken from query parameters, form fields, or other user-controlled sources.

Impact

Local file disclosure. An attacker who can supply reStructuredText content can read files accessible to the NiceGUI server process. Depending on deployment, this may expose:

  • application .env files
  • database URLs, API tokens, session/storage secrets
  • OAuth or cloud credentials
  • Docker or Kubernetes mounted secrets
  • application source files
  • logs and other process-readable files

The confirmed impact is confidentiality loss through arbitrary local file read. Applications are only impacted when they pass untrusted or user-controlled reStructuredText into ui.restructured_text().

Recommended fix

Disable unsafe Docutils features in prepare_content():

python
html = publish_parts(
    remove_indentation(content),
    writer_name='html4',
    settings_overrides={
        'syntax_highlight': 'short',
        'file_insertion_enabled': False,
        'raw_enabled': False,
        '_disable_config': True,
    },
)

This blocks the include, csv-table :file:, and raw :file: directives as well as local docutils.conf overrides.

Betroffene Software

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

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

Verweise

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

Quellen und Lizenzen

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

OSV / GitHub Advisory Database - GHSA-jfrm-rx66-g536 - 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: Local file disclosure via Docutils file insertion in ui.restructured_text() dieser Eintrag
    Hoch · 7.5 CVE-2026-45553 < 3.12.0 3.12.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.