GHSA-86mf-q4h5-69gp / CVE-2026-59988: django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS
- Source:
- GitHub Security Advisories
- Published:
- Fetched:
- Updated:
- Affects:
- django-docutils
https://github.com/advisories/GHSA-86mf-q4h5-69gp ↗
django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS ## Summary django-docutils before `0.30.0` rendered reStructuredText through Docutils without protected web-safe defaults. Public rendering paths, including `publish_doctree`, `publish_html_from_source`, `publish_html_from_doctree`, `publish_parts_from_doctree`, the `{% rst %}` template tag, the `rst` template filter, `DocutilsTemplates`, and `DocutilsView`, could process attacker-controlled RST with Docutils directives that read local files, fetch URL-backed content, or emit raw HTML. The issue is fixed in `0.30.0` by disabling Docutils file insertion, raw directives, local `docutils.conf` processing, and unsafe URI schemes by default, and by sanitizing doctrees before HTML is emitted. Applications are affected when they render attacker-controlled or lower-trust RST through django-docutils without their own safe Docutils configuration. Applications that only render trusted static RST are not affected unless that content can be influenced by an attacker. ## Impact An attacker who can influence RST rendered by a vulnerable django-docutils integration may be able to read files readable by the Django worker process, trigger server-side requests through URL-backed directives, or inject raw HTML/JavaScript into rendered output. Examples of affected application patterns include comments, wiki pages, blog bodies, profile or biography fields, CMS fields, uploaded RST documents, API-supplied RST, or overridden view content methods that return user-supplied RST. Potential impact includes disclosure of application configuration, environment files, credentials, source files, templates, mounted secrets, and logs readable by the process. UI escaping after rendering is not sufficient for file disclosure because the server-side read occurs before HTML reaches the client. ## Affected versions Affected package: `django-docutils` on PyPI Affected versions: `<= 0.29.0` Patched versions: `>= 0.30.0` ## Technical details Before `0.30.0`, django-docutils handed RST content to Docutils without forcing these web-safe settings: ```python { "file_insertion_enabled": False, "raw_enabled": False, "_disable_config": True, } ``` Docutils treats file insertion and raw content as legitimate features for trusted documents. In a web application that renders lower-trust RST, those defaults can expose server-side data or emit attacker-controlled HTML unless the application disables the features. The vulnerable behavior included: - `.. include:: ` reading local files - `.. include:: ` fetching URL-backed content server-side - `.. csv-table:: :file:` reading local files - `.. csv-table:: :url:` fetching URL-backed content server-side - `.. raw:: html` emitting unescaped HTML - `.. raw:: html :file:` reading and emitting file-backed raw content - local `docutils.conf` configuration re-enabling unsafe behavior ## Proof of concept This minimal harness uses the public `{% rst %}` template tag. On vulnerable versions, the include directive expands Affected packages: pip:django-docutils Patched: django-docutils 0.30.0