Skip to content
CVE-2026-59988 Microsoft Sentinel · KQL

Detect CVE-2026-59988: django-docutils Unsafe Docutils Defaults (LFI / SSRF / Stored XSS) in Microsoft Sentinel

Detects exploitation of CVE-2026-59988 in django-docutils < 0.30.0, where unsafe Docutils default settings allow reStructuredText (reST) input to trigger local file disclosure via directives such as `.. include::` and `.. raw::`, server-side request forgery (SSRF) via URL-referencing directives, and stored cross-site scripting (XSS) via `.. raw:: html`. Detection focuses on reST payload patterns in HTTP request bodies/parameters reaching Django endpoints, unexpected outbound requests originating from the Django application process, and application reads of sensitive local files (e.g. /etc/passwd, settings, secrets) following reST rendering.

MITRE ATT&CK

Tactic
Initial Access Collection Exfiltration

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// df00tech DF00-38311fe1bb · https://df00tech.com/detections/CVE-2026-59988 · licence: https://df00tech.com/detections/licence
let reSTPatterns = dynamic([".. include::", ".. raw::", ".. raw:: html", ".. csv-table::", ".. figure::", ".. image::", ":file:", "include::"]);
let sensitiveFiles = dynamic(["/etc/passwd", "/etc/shadow", "settings.py", ".env", "id_rsa", "secret_key", "/proc/self/environ"]);
AppRequests
| where TimeGenerated > ago(24h)
| extend body = tostring(Properties.requestBody), uri = tostring(Url)
| where body has_any (reSTPatterns) or uri has_any (reSTPatterns)
| where body has_any (sensitiveFiles) or body has "file://" or body has "http://" or body has "https://"
| project TimeGenerated, ClientIP = tostring(Properties.clientIp), uri, body, OperationName
| order by TimeGenerated desc
high severity medium confidence

Flags inbound HTTP requests to a Django app carrying reStructuredText directive markers combined with sensitive-file or URL references, indicating attempts at local file disclosure, SSRF, or stored XSS via django-docutils.

Data Sources

Azure Application InsightsDjango application request logsWeb application firewall logs

Required Tables

AppRequests

False Positives & Tuning

  • Documentation platforms that legitimately accept reStructuredText input from trusted authors
  • Internal CI or content-migration jobs posting reST documents containing include directives
  • Security scanners and QA pipelines submitting reST payloads during testing

Other platforms for CVE-2026-59988


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 reST include directive local file disclosure attempt

    Expected signal: Web/app request log entry with body containing '.. include:: /etc/passwd'

  2. Test 2 reST SSRF via URL-referencing directive

    Expected signal: Inbound request log with reST image directive and http:// URL; outbound connection from app to 169.254.169.254

  3. Test 3 reST stored XSS via raw html directive

    Expected signal: Request log with '.. raw:: html' and <script> content


Response Playbook

Triage

  1. Confirm the deployed django-docutils version; versions < 0.30.0 are vulnerable. Check `pip show django-docutils` on the app host.
  2. Extract the full reST payload from the flagged request and identify which directive was used (`.. include::`, `.. raw:: html`, or a URL-referencing directive) to determine whether the attempt targeted LFI, SSRF, or stored XSS.
  3. Correlate the source IP and authenticated user/session with the request to determine whether the submitter is a trusted author or an untrusted actor.
  4. Check application responses/logs to determine whether the directive rendered successfully (e.g. file contents returned in the HTTP response or stored for later display).

Containment

  1. Deploy a WAF rule to block request bodies/parameters containing `.. include::`, `.. raw::`, and `file://` schemes against the affected endpoints until patched.
  2. Upgrade django-docutils to >= 0.30.0, which ships hardened Docutils defaults, and restart the application.
  3. If stored XSS content may have been persisted, quarantine affected records and purge rendered HTML caches.

Evidence Collection

  1. Preserve the raw HTTP request (headers + body) and the corresponding application response for the flagged events.
  2. Capture application and web server access logs covering the suspected exploitation window, plus any stored reST documents created by the source principal.

Escalation Criteria

  • !Escalate to IR if an HTTP response or log confirms that a sensitive local file (e.g. /etc/passwd, settings.py, .env) was disclosed.
  • !Escalate if outbound requests to attacker-controlled or internal metadata endpoints (e.g. 169.254.169.254) originated from the Django application process, indicating successful SSRF.

Investigation Guide

Forensic Artifacts

  • >Web/app access logs containing reST directive payloads
  • >Stored reST documents and rendered HTML in the application database
  • >Outbound connection records from the Django app process (netstat/conntrack, proxy logs)
  • >django-docutils and Docutils package versions in the deployed virtualenv

Tuning Guidance

If the application legitimately accepts reStructuredText from trusted, authenticated authors, scope the detection to unauthenticated or low-privilege sessions and exclude known content-management service accounts. Raise severity when the directive co-occurs with sensitive file paths or internal/metadata URLs, and lower confidence for endpoints that only render reST from vetted internal sources.


Hunting Queries

Surfaces all requests containing reST include/raw directives for retrospective hunting across the exposure window.

Hunting — KQL
kql
// df00tech DF00-38311fe1bb · https://df00tech.com/detections/CVE-2026-59988 · licence: https://df00tech.com/detections/licence
AppRequests | where Properties.requestBody has ".. include::" or Properties.requestBody has ".. raw::" | project TimeGenerated, Url, tostring(Properties.requestBody), tostring(Properties.clientIp)
Hunting — SPL
spl
``` df00tech DF00-38311fe1bb · https://df00tech.com/detections/CVE-2026-59988 · licence: https://df00tech.com/detections/licence ```
index=web (request_body="*.. include::*" OR request_body="*.. raw::*") | table _time src_ip uri_path request_body

Atomic Red Team Tests

Test 1 reST include directive local file disclosure attempt
linux

Submit a reST payload using the include directive to read /etc/passwd via a vulnerable django-docutils rendering endpoint.

Command

bash
curl -s -X POST http://localhost:8000/render/ --data-urlencode 'content=.. include:: /etc/passwd'

Cleanup

bash
echo 'No persistent artifacts; clear any test render cache if present'

Expected Telemetry

Web/app request log entry with body containing '.. include:: /etc/passwd'

Expected Detection

KQL/SPL rules match reST directive + /etc/passwd sensitive-file pattern

Test 2 reST SSRF via URL-referencing directive
linux

Submit a reST payload referencing an internal URL to trigger server-side request forgery.

Command

bash
curl -s -X POST http://localhost:8000/render/ --data-urlencode 'content=.. image:: http://169.254.169.254/latest/meta-data/'

Cleanup

bash
echo 'No persistent artifacts to remove'

Expected Telemetry

Inbound request log with reST image directive and http:// URL; outbound connection from app to 169.254.169.254

Expected Detection

Detection matches reST directive + URL scheme pattern

Test 3 reST stored XSS via raw html directive
linux

Submit a reST payload using the raw html directive to inject a script, testing stored XSS.

Command

bash
curl -s -X POST http://localhost:8000/render/ --data-urlencode 'content=.. raw:: html\n\n   <script>alert(1)</script>'

Cleanup

bash
echo 'Delete any stored test document created during the test'

Expected Telemetry

Request log with '.. raw:: html' and <script> content

Expected Detection

Detection matches '.. raw::' directive pattern in request body

Related Detections