GitHub advisory · PyPI
django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS
Description
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.
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 package: django-docutils on PyPI
Affected versions: <= 0.29.0
Patched versions: >= 0.30.0
Before 0.30.0, django-docutils handed RST content…
Manual fix · PyPI
pip install --upgrade "django-docutils>=0.30.0"Sources