Executive brief
Mistune, a popular Python library for parsing Markdown, contains a vulnerability in its 'Include' directive. If an application uses this library to process Markdown files from untrusted sources, an attacker could potentially read sensitive files from the server's local storage. This could lead to the exposure of configuration files, credentials, or other private data.
Technical details
A path traversal vulnerability exists in the `Include.parse()` method of the Mistune library. The root cause is the lack of validation when joining and normalizing user-supplied paths in the `Include` directive, allowing the use of `../` sequences to escape the intended directory. An attacker can exploit this by providing a crafted Markdown file that includes local system files. This vulnerability is reachable if the `RSTDirective` with `Include` is enabled and the application processes untrusted Markdown via `md.read()`. The issue is fixed in version 3.3.0.
Affected products
- lepture mistune < 3.3.0
Timeline
- 2026-06-21: disclosed: Initial disclosure by reporter 0x5t4l1n
- 2026-07-08: advisory: NVD publication date
- 2026-07-20: advisory: GitHub Advisory Database publication date
- 2026-07-20: patched: Version 3.3.0 released