---
id: "CVE-2026-115355"
kind: "vulnerability"
aliases: ["CVE-2026-115355", "GHSA-h7ww-273w-6cm8"]
title: "Mistune: Path Traversal and XSS in Include directive"
severity: "high"
cvss: 8.7
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "mistune", "fixed": ["3.3.0"], "affected": "<= 3.2.0", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-22", "markdown-rendering", "mistune", "package", "pypi", "python"]
not_affected_if: ["default-config", "include-plugin-disabled", "version-3.3.0-or-later"]
published_at: "2026-10-22T19:17:41+00:00"
first_seen_at: "2026-10-23T20:59:05+00:00"
updated_at: "2026-10-23T21:57:31+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-h7ww-273w-6cm8", "first_seen_at": "2026-10-23T20:59:05+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115355", "first_seen_at": "2026-10-23T21:57:31+00:00"}]
---

# Mistune: Path Traversal and XSS in Include directive

Mistune's Include directive does not check that included file paths stay inside the source directory, so `../` sequences read arbitrary files on the server. Included file contents and error messages are also rendered without HTML escaping, enabling XSS even when escape=True is set.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:mistune affected <= 3.2.0 fixed 3.3.0

## How to check

Run `pip show mistune` and check whether the version is 3.2.0 or lower.
Search the code for `mistune.create_markdown` or `plugins=` that includes `include` or `directive`.

## Fix

Upgrade mistune to 3.3.0 or later.
If upgrading is not possible, remove the Include plugin from the plugins parameter.

## Timeline

- 2026-10-23T20:59:05+00:00 ghsa https://github.com/advisories/GHSA-h7ww-273w-6cm8
- 2026-10-23T21:57:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-115355

## From the sources

The Include directive in `src/mistune/directives/include.py` does not validate that the resolved file path stays within the source directory, allowing path traversal via `../` sequences to read arbitrary files.

Additionally, error messages and included file contents are rendered without HTML escaping, leading to XSS even when `escape=True`.

Affected functions:
- Path resolution (lines 27-31)
- `block_error()` in html.py (line 140)
- `render_html_include()` (line 72)

The Include plugin must be explicitly enabled via the plugins parameter.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
