{"id":"CVE-2026-59924","aliases":["CVE-2026-59924","GHSA-r4rv-85jg-w4mf","PYSEC-2026-2212"],"related":[],"kind":"vulnerability","state":"published","title":"Mistune: Arbitrary File Read via Include directive path traversal","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nA 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.\n\n### Details\n\nThe 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.\n\n```python\nrelpath = self.parse_title(m)\ndest = os.path.join(os.path.dirname(source_file), relpath)\ndest = os.path.normpath(dest)\n```\n\nBecause the final path is not restricted to a trusted base directory, path traversal sequences such as `../` may reference files outside the intended location.\n\n### Proof of Concept\n\nCreate a markdown file:\n\n```markdown\n.. include:: ../../../example.txt\n```\n\nProcess it using:\n\n```python\nimport mistune\nfrom mistune.directives import RSTDirective, Include\n\nmd = mistune.create_markdown(\n    plugins=[RSTDirective([Include()])]\n)\n\nresult, state = md.read(\"test.md\")\nprint(result)\n```\n\n### Impact\n\nApplications 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.\n\n### Recommended Fix\n\nValidate the resolved path and ensure it remains within an allowed directory before opening the file.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Mistune es un analizador de Markdown para Python con renderizadores y complementos. Antes de la versión 3.3.0, Include.parse() une y normaliza rutas de inclusión proporcionadas por el usuario sin verificar que el resultado permanezca dentro del directorio de markdown previsto, lo que permite que rutas de inclusión manipuladas accedan a archivos fuera de ese directorio cuando los archivos de markdown se procesan usando md.read(). Este problema se solucionó en la versión 3.3.0.","source":"nvd"}],"published":"2026-07-08T16:22:11.116Z","modified":"2026-10-25T17:10:00.197Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 3.3.0","status":"affected"}],"vendor":"lepture","product":"mistune","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.3.0"}],"ecosystem":"PyPI","package":"mistune","purl":"pkg:pypi/mistune","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.3.0"}],"vendor":"mistune_project","product":"mistune","cpe":"cpe:2.3:a:mistune_project:mistune:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.3.0"}],"ecosystem":"PyPI","package":"mistune","purl":"pkg:pypi/mistune","source":"pysec"}],"references":[{"url":"https://github.com/lepture/mistune/security/advisories/GHSA-r4rv-85jg-w4mf","tags":["evidence","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/lepture/mistune/commit/1bef343ade163fc3bb95572b15be720084cdb993","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/lepture/mistune/releases/tag/v3.3.0","tags":["advisory","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59924","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/lepture/mistune","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2212.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-08T17:10:16.347Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-59924","url":"https://www.cve.org/CVERecord?id=CVE-2026-59924","licence":"CVE Terms of Use","modified":"2026-07-08T17:10:47.834Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r4rv-85jg-w4mf","url":"https://github.com/advisories/GHSA-r4rv-85jg-w4mf","licence":"CC-BY-4.0","modified":"2026-07-20T21:46:41.298Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-59924","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59924","licence":"Public domain","modified":"2026-10-25T17:10:00.197Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2212","url":"https://osv.dev/vulnerability/PYSEC-2026-2212","licence":"CC-BY-4.0","modified":"2026-07-13T07:15:18.817Z"}],"updatedAt":"2026-11-25T22:59:27.403Z","epss":{"score":0.00399,"percentile":0.36328,"date":"2026-12-01T12:00:22.000Z"}}