Vulnerabilities in pkg:pypi/django-docutils

PACKAGE
Advisory Identifier: GHSA-86mf-q4h5-69gp
Advisory Summary

CVE-2026-59988 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Django docutils libraries in the PyPI ecosystem. The issue involves django-docutils unsafe docutils defaults allow local file disclosure, ssrf, and stored xss. Remediation is available by upgrading affected packages to version 0.30.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/django-docutils

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/django-docutils. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-86mf-q4h5-69gp CVE-2026-59988 HIGH django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS

CVE-2026-59988 at a Glance

CVE Identifier CVE-2026-59988
GHSA Identifier GHSA-86mf-q4h5-69gp
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Django docutils
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-59988

To remediate this vulnerability, upgrade all affected Django docutils dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

django-docutils fixed: 0.30.0
pip install django-docutils>=0.30.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show django-docutils

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-59988, inspect your installed packages using pip:

pip show django-docutils

Analyze the terminal output to locate any version of Django docutils in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.30.0), your application is affected.

Note: The pip show django-docutils command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Django docutils, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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:: <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. ```python 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`: ```text 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: ```text 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: ```python 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.

CVE-2026-59988 Affected Django docutils Versions

1 component(s)
Fixed Versions:
0.30.0
Product / Package Ecosystem Affected Versions Fixed Version
django-docutils
PyPI
< 0.30.0
0.30.0

References

Frequently Asked Questions

What is CVE-2026-59988?
CVE-2026-59988 is a security vulnerability in Django docutils involving django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Django docutils versions are affected?
Affected versions include releases prior to 0.30.0 across affected packages: django-docutils.
What version fixes CVE-2026-59988?
Upgrading to 0.30.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is django-docutils affected?
Yes, django-docutils is affected in releases prior to 0.30.0. Upgrade your dependency to 0.30.0 or later.
What is the CVSS score of CVE-2026-59988?
CVE-2026-59988 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2026-59988?
CVE-2026-59988 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check PyPI dependencies for CVE-2026-59988?
Run the dependency tree command: 'pip show django-docutils'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-86mf-q4h5-69gp",
  "modified" : "2026-11-20T00:08:12Z",
  "published" : "2026-11-20T00:08:12Z",
  "aliases" : [ "CVE-2026-59988" ],
  "summary" : "django-docutils unsafe Docutils defaults allow local file disclosure, SSRF, and stored XSS",
  "details" : "## Summary\n\ndjango-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.\n\nThe 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.\n\nApplications 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.\n\n## Impact\n\nAn 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.\n\nExamples 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.\n\nPotential 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.\n\n## Affected versions\n\nAffected package: `django-docutils` on PyPI\n\nAffected versions: `<= 0.29.0`\n\nPatched versions: `>= 0.30.0`\n\n## Technical details\n\nBefore `0.30.0`, django-docutils handed RST content to Docutils without forcing these web-safe settings:\n\n```python\n{\n    \"file_insertion_enabled\": False,\n    \"raw_enabled\": False,\n    \"_disable_config\": True,\n}\n```\n\nDocutils 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.\n\nThe vulnerable behavior included:\n\n- `.. include:: <file>` reading local files\n- `.. include:: <url>` fetching URL-backed content server-side\n- `.. csv-table:: :file:` reading local files\n- `.. csv-table:: :url:` fetching URL-backed content server-side\n- `.. raw:: html` emitting unescaped HTML\n- `.. raw:: html :file:` reading and emitting file-backed raw content\n- local `docutils.conf` configuration re-enabling unsafe behavior\n\n## Proof of concept\n\nThis 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.\n\n```python\nimport django\nfrom django.conf import settings\n\nsettings.configure(\n    INSTALLED_APPS=[\"django_docutils\"],\n    TEMPLATES=[{\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [], \"APP_DIRS\": False,\n        \"OPTIONS\": {\"libraries\": {\"dj\": \"django_docutils.templatetags.django_docutils\"}},\n    }],\n    # DJANGO_DOCUTILS_LIB_RST intentionally unset == default install.\n)\ndjango.setup()\n\nfrom django.template import engines\n\ndj = engines[\"django\"]\n\ndef render_user_rst(rst: str) -> str:\n    return dj.from_string(\"{% load dj %}{% rst content %}\").render({\"content\": rst})\n\nprint(render_user_rst(\".. include:: /etc/passwd\\n\"))\nprint(render_user_rst(\".. raw:: html\\n\\n   <b>x</b>\\n\"))\n```\n\nExpected behavior on vulnerable releases such as `0.28.0` and `0.29.0`:\n\n```text\nThe include directive emits readable file contents.\nThe raw directive emits <b>x</b> as HTML.\n```\n\nExpected behavior on fixed releases such as `0.30.0` and later:\n\n```text\nThe include directive is disabled.\nThe raw directive is disabled.\n```\n\n## Remediation\n\nUpgrade to django-docutils `0.30.0` or later.\n\nFor trusted static RST that intentionally depends on unsafe Docutils features, opt in explicitly:\n\n```python\nDJANGO_DOCUTILS_LIB_RST = {\n    \"allow_unsafe_docutils_settings\": True,\n    \"docutils\": {\n        \"raw_enabled\": True,\n        \"file_insertion_enabled\": True,\n        \"_disable_config\": False,\n    },\n}\n```\n\nDo not enable unsafe Docutils settings for comments, profile text, CMS fields, uploaded files, API request data, or other lower-trust content.\n\nNote: `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).\n\n## Related\n\n- django-docutils documentation: <https://django-docutils.git-pull.com>\n- django-docutils 0.30.0:\n  - <https://django-docutils.git-pull.com/history/#django-docutils-0-30-0-2026-06-07>\n  - <https://github.com/tony/django-docutils/blob/v0.30.0/CHANGES#django-docutils-0300-2026-06-07>\n- django-docutils security topic: <https://django-docutils.git-pull.com/topics/security/>\n- django-docutils changelog: <https://django-docutils.git-pull.com/history/>\n- django-docutils PyPI: <https://pypi.org/project/django-docutils/>\n- django-docutils source repository: <https://github.com/tony/django-docutils>\n- Docutils security guide: <https://docutils.sourceforge.io/docs/howto/security.html>\n- Docutils configuration reference: <https://docutils.sourceforge.io/docs/user/config.html>\n- Django security overview: <https://docs.djangoproject.com/en/stable/topics/security/>\n- Related NiceGUI advisory for the same Docutils sink pattern: <https://github.com/advisories/GHSA-jfrm-rx66-g536>\n- Related NiceGUI CVE entry: <https://nvd.nist.gov/vuln/detail/CVE-2026-45553>\n\n## Credit\n\nThanks to the reporters who disclosed and helped characterize this issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "django-docutils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.30.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tony/django-docutils/security/advisories/GHSA-86mf-q4h5-69gp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59988"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tony/django-docutils/pull/457"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tony/django-docutils/commit/274caaf14c2368fafeb45f178094a34ba538f067"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tony/django-docutils/commit/57fd751a10ce2969e4ca2bde6a9094fa2e2ba0dd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tony/django-docutils"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tony/django-docutils/blob/v0.30.0/CHANGES"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-22", "CWE-79", "CWE-918" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-20T00:08:12Z",
    "nvd_published_at" : "2026-11-19T17:18:58Z"
  }
}