CVE-2026-59924: Mistune: Arbitrary File Read via Include directive path traversal

Published Jul 8, 2026
·
Updated

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.

python relpath = self.parsetitle(m) dest = os.path.join(os.path.dirname(sourcefile), 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:

markdown .. include:: ../../../example.txt

Process it using:

python import mistune from mistune.directives import RSTDirective, Include

md = mistune.createmarkdown( 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.

Other sources

Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, Include.parse() joins and normalizes user-supplied include paths without verifying that the result remains within the intended markdown directory, allowing crafted include paths to access files outside that directory when markdown files are processed using md.read(). This issue is fixed in version 3.3.0.

MITRE

Affected Software

3 affected componentsFixes available
Mistune Mistune<3.3.0
Mistune Project Mistune<3.3.0
pip/mistune<3.3.0
3.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/mistune to a version that resolves this vulnerability.

    Fixed in 3.3.0
  2. Upgrade

    Upgrade mistune to a version that resolves this vulnerability.

    Fixed in 3.3.0
  3. Configuration

    When using Mistune's `Include` directive (in `Include.parse()`), validate the resolved path after `os.path.join()` and `os.path.normpath()` to ensure it remains within the trusted/allowed base markdown directory; block/ignore any resolved paths containing traversal (e.g., `../`) that would escape the allowed directory before opening the included file.

    Include directive path handling (Mistune Include.parse) base-directory validation for resolved include paths = Validate that the normalized/joined resolved path remains within the intended markdown directory before opening the file

Event History

Jul 8, 2026
CVE Published
via MITRE·04:22 PM
Data Sourced
via MITRE·04:22 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 20, 2026
Advisory Published
via GitHub·09:34 PM
Data Sourced
via GitHub·09:34 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-59924?

The severity of CVE-2026-59924 is classified as medium with a score of 5.9.

2

What does CVE-2026-59924 affect?

CVE-2026-59924 affects the Mistune Python Markdown parser prior to version 3.3.0.

3

How do I fix CVE-2026-59924?

To fix CVE-2026-59924, upgrade Mistune to version 3.3.0 or later.

4

What type of vulnerability is CVE-2026-59924?

CVE-2026-59924 is a path traversal vulnerability that allows arbitrary file read.

5

What impact does CVE-2026-59924 have on systems?

CVE-2026-59924 allows crafted include paths to access files outside the intended markdown directory, potentially leaking sensitive information.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203