/

CVE-2026-45553

Severity:

HIGH RISK

(7.5)

Server-Side reStructuredText Rendering Information Exposure (CWE-200) in NiceGUI ui.restructured_text()

CVE-2026-45553

Deferred

Vulnerability type

Category:

Information Exposure

CWE:

CWE-200

Impact:

Unauthorized File Read / Information Disclosure on the Server

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

NiceGUI's ui.restructured_text() renders user-supplied reStructuredText on the server with Docutils while leaving file inclusion directives enabled, allowing template content to reference local files.

If an application passes attacker-controlled text into ui.restructured_text(), an attacker can cause the server to embed the contents of local files that are readable by the NiceGUI process into the rendered output.

Affected context

This vulnerability exists in NiceGUI applications that:

  • Use ui.restructured_text() to render reStructuredText on the server, and
  • Accept and forward user-controlled or otherwise untrusted text into that API, and
  • Run the NiceGUI server with access to sensitive local files (configuration, secrets, logs, or source code).

Applications that only ever render fixed, trusted strings through ui.restructured_text() are not directly impacted by this issue.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints or UI interactions that accept text input and pass it to ui.restructured_text().
  • Required access: Ability to supply or influence the reStructuredText content rendered by the server (e.g., form input, database-stored content, CMS-like features, chat/comments).
  • Trigger point: Server-side rendering of reStructuredText via Docutils when the content contains file-related directives (such as .. include::, .. csv-table:: with :file:, or .. raw:: with :file:).
  • Why exploitation is possible: Docutils is invoked with file insertion directives enabled, so the renderer treats directive arguments as file paths relative to the server and reads those files into the rendered output without enforcing a strict allowlist of safe locations.

Why this happens

The underlying issue is the server-side rendering of a powerful markup language (reStructuredText) with untrusted input, without restricting features that can reach the file system.

Specifically, the NiceGUI ui.restructured_text() helper calls Docutils in a configuration that leaves file insertion directives (e.g., include, csv-table with :file:, raw with :file:) enabled. When attacker-controlled text is passed into this renderer, Docutils will follow these directives and read local files from disk, reflecting their contents in the generated HTML. This maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because filesystem contents that should remain private become reachable through the application's rendering behavior.

Potential impact

  • Disclosure of configuration files containing secrets, tokens, or database credentials that are readable by the NiceGUI process.
  • Exposure of application source code, templates, internal documentation, or proprietary logic.
  • Leakage of system files and environment details that could assist in further attacks (privilege escalation or lateral movement).
  • Access to server logs or debug traces that may include user data or internal error information.
  • Chaining with other vulnerabilities (e.g., using stolen credentials or keys) to move from information disclosure to full compromise.

General mitigation guidance

Effective mitigation centers on restricting what the reStructuredText renderer is allowed to do and minimizing trust in user input:

  • Disable file and raw directives: Configure Docutils with settings that explicitly disable include, raw, csv-table :file:, and other directives that perform file I/O or embed arbitrary content.
  • Use a restricted markup subset: Prefer a safer, limited mode or a wrapper around Docutils that only allows formatting constructs (headings, lists, emphasis) and rejects structural or I/O-related directives.
  • Treat user input as untrusted content: Avoid passing user-controlled text directly to ui.restructured_text(); instead, use plain text rendering or a safer markup format (e.g., Markdown in a restricted mode) for untrusted content.
  • Constrain server file access: Run the application under a dedicated low-privilege account, use strict filesystem permissions, and isolate sensitive configuration or secrets outside the process-readable path where practical.
  • Apply defense-in-depth controls: Enforce principles like least privilege, separation of concerns (e.g., keeping rendering components isolated), and centralized configuration for safe rendering defaults.

How teams detect issues like this

Organizations can identify and monitor this vulnerability pattern using both code-level and operational approaches:

  • Static analysis and code search:
  • Search for usage of ui.restructured_text() or direct Docutils calls that process variable or user-supplied content.
  • Flag code that passes request parameters, form fields, or database-backed user content directly into reStructuredText renderers.
  • Detect Docutils configuration that leaves file_insertion_enabled or similar options in their default (permissive) state.
  • Code review signals:
  • Pay attention to server-side rendering of rich text or markup languages where users control the content.
  • Question any use of docutils, reStructuredText, or similar tools in web handlers, templates, or APIs receiving user input.
  • Runtime and logging indicators:
  • Instrument or log reStructuredText rendering calls, especially when they open files, to detect anomalies or unexpected file paths.
  • Monitor for suspicious markup patterns in user submissions (e.g., frequent .. include:: or :file: directives).
  • Automated tooling:
  • Incorporate linters or SAST tools that understand common unsafe Docutils configurations.
  • Add CI/CD checks that enforce safe rendering policies and configuration templates for content processing libraries.

Sources

SourceLink
github.comgithub.com/zauberzeug/nicegui/releases/tag/v3.12.0
github.comgithub.com/zauberzeug/nicegui/security/advisories/GHSA-jfrm-rx66-g536

Frequently asked

questions

Yes, if an attacker can submit or control text that the application passes into ui.restructured_text(), they can exploit the vulnerability remotely via normal application interfaces (HTTP, WebSocket, etc.) without needing local server access.

It depends on how the application is built. If only authenticated users can submit content rendered via ui.restructured_text(), then authentication is required. If unauthenticated users can submit such content (e.g., public comments), then an attacker does not need any prior access beyond reaching the application.

The safest approach is to disable file-reading and raw-output directives in Docutils when rendering any content that might be influenced by users, or to avoid using reStructuredText for untrusted input altogether. Use a restricted rendering mode or a simpler markup format that does not support filesystem access, and ensure default rendering settings are secure.

Adopt a standard practice that any server-side processing of rich markup or templates is treated as a high-risk area. Before integrating such libraries, review their security-relevant options, disable features that access external resources or the filesystem, and codify safe defaults in shared utilities. Combine this with regular security reviews, automated checks for dangerous configurations, and a policy of least privilege for the services that perform rendering.

Find out what's already
exploitable in your codebase.