NiceGUI: Local file disclosure via Docutils file insertion in ui.restructured_text()
Date: 2026-05
Affected: pip/nicegui
Attack vector: info-disclosure
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-45553
CWE: CWE-200
CVSS: 7.5 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)

### 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 c


Mitigations:

Architectural layers (MAESTRO):