Junglewise Threat Intelligence

CVE-2026-59927: lepture Mistune uncontrolled recursion in Include directive

CVE-2026-59927 · Severity: medium · CVSS 5.3 · Published 2026-07-08

Executive brief

Mistune is a Python library used to convert Markdown text into HTML. A vulnerability in its 'include' feature allows an attacker to provide specially crafted files that reference each other in a loop. When the library tries to process these files, it enters an infinite loop that crashes the application, leading to a denial of service.

Technical details

The 'Include' directive in Mistune's RSTDirective plugin fails to properly detect transitive inclusion cycles. While it prevents a file from including itself directly, it does not track the stack of included files during recursive parsing. An attacker with the ability to provide Markdown files (e.g., in a CMS or documentation platform) can create a cycle where 'a.md' includes 'b.md' and 'b.md' includes 'a.md'. This causes the Python interpreter to exceed its maximum recursion depth, raising a 'RecursionError' that propagates and crashes the calling process. The vulnerability is fixed in version 3.3.0 by implementing an include stack to track and reject cyclic references.

Affected products

  • lepture mistune < 3.3.0

Timeline

  • 2026-06-21: disclosed
  • 2026-07-20: advisory
  • 2026-07-20: patched: Fixed in version 3.3.0

References

Related threats