Mistune: Arbitrary File Read via Include directive path traversal
Summary
A path traversal issue exists in mistune's Include directive when markdown files are processed using md.read(). A crafted include path can cause files outside the intended markdown directory to be accessed.
Details
The issue occurs in the Include.parse() method where user-supplied paths are joined and normalized without verifying that the resulting path remains within an expected directory.
relpath = self.parse_title(m)
dest = os.path.join(os.path.dirname(source_file), relpath)
dest = os.path.normpath(dest)
Because the final path is not restricted to a trusted base directory, path traversal sequences such as ../ may reference files outside the intended location.
Proof of Concept
Create a markdown file:
.. include:: ../../../example.txt
Process it using:
import mistune
from mistune.directives import RSTDirective, Include
md = mistune.create_markdown(
plugins=[RSTDirective([Include()])]
)
result, state = md.read("test.md")
print(result)
Impact
Applications that process untrusted markdown files with the Include directive enabled may allow unintended file access. The impact depends on how the feature is used and what files are accessible to the running process.
Recommended Fix
Validate the resolved path and ensure it remains within an allowed directory before opening the file.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | mistune | < 3.3.0 | 3.3.0 |
Verweise
- https://github.com/lepture/mistune/releases/tag/v3.3.0
- https://github.com/lepture/mistune/commit/1bef343ade163fc3bb95572b15be720084cdb993
- https://github.com/lepture/mistune/security/advisories/GHSA-r4rv-85jg-w4mf
- https://nvd.nist.gov/vuln/detail/CVE-2026-59924
- https://github.com/lepture/mistune
- https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2212.yaml
- CVSS-Vektor
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N- Schwäche (CWE)
CWE-22- Plattform
- Python (PyPI)
- Paket
mistune- Veröffentlicht
- 08.07.2026
- Aktualisiert
- 11.10.2026 14:18
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2026-2212 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-r4rv-85jg-w4mf - CC BY 4.0
Schwachstellenhistorie: mistune
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 20
- Erste → letzte
- 10.2017 09.2026
- Ohne Fix
- 1
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Hoch 7
- Mittel 13
Veröffentlichungen pro Jahr
- 2017: 2
- 2018: 0
- 2019: 0
- 2020: 0
- 2021: 0
- 2022: 1
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 17
-
Mistune: Arbitrary File Read via Include directive path traversal dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.