llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · django-docutils

GHSA-86MF-Q4H5-69GP

django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión0.30.0
Exposición6 hDesde la divulgación, 19 nov 2026, 7:08 p. m.
Detección10 minDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Monitoreo
Detectada +1
07:08 p. m.
12:50 a. m.
07:08 p. m.
08:33 p. m.
09:59 p. m.
11:24 p. m.
12:50 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-86MF-Q4H5-69GP divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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:

{
    "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:: <file>` reading local files
  • `.. include:: <url>` 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 server-side and the raw directive emits unescaped HTML. On fixed versions, both directives are disabled under the default configuration.

import django
from django.conf import settings

settings.configure(
    INSTALLED_APPS=["django_docutils"],
    TEMPLATES=[{
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [], "APP_DIRS": False,
        "OPTIONS": {"libraries": {"dj": "django_docutils.templatetags.django_docutils"}},
    }],
    # DJANGO_DOCUTILS_LIB_RST intentionally unset == default install.
)
django.setup()

from django.template import engines

dj = engines["django"]

def render_user_rst(rst: str) -> str:
    return dj.from_string("{% load dj %}{% rst content %}").render({"content": rst})

print(render_user_rst(".. include:: /etc/passwd\n"))
print(render_user_rst(".. raw:: html\n\n   <b>x</b>\n"))

Expected behavior on vulnerable releases such as `0.28.0` and `0.29.0`:

The include directive emits readable file contents.
The raw directive emits <b>x</b> as HTML.

Expected behavior on fixed releases such as `0.30.0` and later:

The include directive is disabled.
The raw directive is disabled.

Remediation

Upgrade to django-docutils `0.30.0` or later.

For trusted static RST that intentionally depends on unsafe Docutils features, opt in explicitly:

DJANGO_DOCUTILS_LIB_RST = {
    "allow_unsafe_docutils_settings": True,
    "docutils": {
        "raw_enabled": True,
        "file_insertion_enabled": True,
        "_disable_config": False,
    },
}

Do not enable unsafe Docutils settings for comments, profile text, CMS fields, uploaded files, API request data, or other lower-trust content.

Note: `django-docutils==0.30.0` has an undeclared runtime dependency on `typing-extensions`; install it alongside if your environment doesn't already provide it (tracked separately as a packaging fix).

Related

  • django-docutils documentation: <https://django-docutils.git-pull.com>
  • django-docutils 0.30.0:
  • <https://django-docutils.git-pull.com/history/#django-docutils-0-30-0-2026-06-07>
  • <https://github.com/tony/django-docutils/blob/v0.30.0/CHANGES#django-docutils-0300-2026-06-07>
  • django-docutils security topic: <https://django-docutils.git-pull.com/topics/security/>
  • django-docutils changelog: <https://django-docutils.git-pull.com/history/>
  • django-docutils PyPI: <https://pypi.org/project/django-docutils/>
  • django-docutils source repository: <https://github.com/tony/django-docutils>
  • Docutils security guide: <https://docutils.sourceforge.io/docs/howto/security.html>
  • Docutils configuration reference: <https://docutils.sourceforge.io/docs/user/config.html>
  • Django security overview: <https://docs.djangoproject.com/en/stable/topics/security/>
  • Related NiceGUI advisory for the same Docutils sink pattern: <https://github.com/advisories/GHSA-jfrm-rx66-g536>
  • Related NiceGUI CVE entry: <https://nvd.nist.gov/vuln/detail/CVE-2026-45553>

Credit

Thanks to the reporters who disclosed and helped characterize this issue.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida
django-docutils< 0.30.0
0.30.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
PyPIdjango-docutils
Corregida 0.30.0 — —
Versiones corregidas0.30.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-59988
Otrahttps://github.com/tony/django-docutils/security/advisories/GHSA-86mf-q4h5-69gp
Otrahttps://github.com/tony/django-docutils/pull/457
Otrahttps://github.com/tony/django-docutils/commit/274caaf14c2368fafeb45f178094a34ba538f067
Otrahttps://github.com/tony/django-docutils/commit/57fd751a10ce2969e4ca2bde6a9094fa2e2ba0dd
Otrahttps://github.com/tony/django-docutils
Otrahttps://github.com/tony/django-docutils/blob/v0.30.0/CHANGES

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.