Mistune: Path Traversal and XSS in Include directive
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.
What to do
Upgrade mistune to version 3.3.0 or later.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | mistune | < 3.3.0 | 3.3.0 |
References
- https://github.com/lepture/mistune/security/advisories/GHSA-h7ww-273w-6cm8
- https://nvd.nist.gov/vuln/detail/CVE-2026-115355
- https://github.com/lepture/mistune/commit/1bef343ade163fc3bb95572b15be720084cdb993
- https://github.com/lepture/mistune
- https://github.com/lepture/mistune/releases/tag/v3.3.0
- https://www.vulncheck.com/advisories/mistune-before-3.3.0-path-traversal-and-xss-via-include-directive
- Weakness (CWE)
CWE-22- Platform
- Python (PyPI)
- Package
mistune- Disclosed
- 23.10.2026
- Updated
- 28.10.2026 10:00
Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.
OSV / GitHub Advisory Database - GHSA-h7ww-273w-6cm8 - CC BY 4.0
Vulnerability history: mistune
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 21
- First → latest
- 10.2017 10.2026
- Without a fix
- 1
- Exploited in attacks
- 0
Severity breakdown
- High 8
- Medium 13
Disclosures per year
- 2017: 2
- 2018: 0
- 2019: 0
- 2020: 0
- 2021: 0
- 2022: 1
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 18
-
Mistune: Path Traversal and XSS in Include directive this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.