7.5high
NiceGUI: Local file disclosure via Docutils file insertion in ui.restructured_text()
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.34% (higher than 28% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-jfrm-rx66-g536PYSEC-2026-2679
Description
NiceGUI is a Python-based UI framework. Prior to version 3.12.0, 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. This issue has been patched in version 3.12.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| zauberzeug nicegui | < 3.12.0 | CVE List |
| nicegui (PyPI) | before 3.12.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| PyPA Advisory Database | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
NiceGUI is a Python-based UI framework. Prior to version 3.12.0, 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. This issue has been patched in version 3.12.0.
GitHub Advisory Database
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:
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
.envfiles - 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():
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.
NVD (es)
NiceGUI es un framework de interfaz de usuario (UI) basado en Python. Antes de la versión 3.12.0, ui.restructured_text() renderiza reStructuredText del lado del servidor con Docutils sin deshabilitar las directivas de inserción de archivos. Cuando una aplicación NiceGUI pasa contenido controlado por el atacante a ui.restructured_text(), un atacante puede usar directivas estándar de Docutils (include, csv-table con :file:, raw con :file:) para leer archivos locales legibles por el proceso del servidor de NiceGUI. Las aplicaciones que solo pasan cadenas estáticas confiables a ui.restructured_text() no se ven afectadas. Este problema ha sido parcheado en la versión 3.12.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-45553 changed 2026-06-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-jfrm-rx66-g536 changed 2026-07-13 | CC-BY-4.0 |
| NVD | CVE-2026-45553 changed 2026-07-22 | Public domain |
| PyPA Advisory Database | PYSEC-2026-2679 changed 2026-07-13 | CC-BY-4.0 |