Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-59940

CVE-2025-59940: MkDocs Include Plugin Input Vulnerability

CVE-2025-59940 is an input validation flaw in mkdocs-include-markdown-plugin where unvalidated input can collide with substitution placeholders. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2025-59940 Overview

CVE-2025-59940 affects mkdocs-include-markdown-plugin, a plugin that enables Markdown file inclusion within MkDocs documentation projects. The vulnerability exists in versions 7.1.7 and below, where unvalidated input can collide with internal substitution placeholders used by the plugin. Attackers can supply crafted content that interferes with the placeholder substitution logic, leading to unexpected behavior during Markdown processing. The maintainer resolved the issue in version 7.1.8. The flaw is categorized under [CWE-20] Improper Input Validation and requires no authentication or user interaction to trigger over the network.

Critical Impact

Unvalidated input collides with substitution placeholders in the plugin, allowing attackers to interfere with Markdown processing and affect content integrity and availability of documentation builds.

Affected Products

  • mkdocs-include-markdown-plugin versions 7.1.7 and below
  • MkDocs documentation projects that consume the vulnerable plugin
  • Build pipelines that process untrusted Markdown content through the plugin

Discovery Timeline

  • 2025-09-29 - CVE-2025-59940 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-59940

Vulnerability Analysis

The mkdocs-include-markdown-plugin uses internal substitution placeholders to process directives such as include and include-markdown within Markdown source files. In versions at or below 7.1.7, the plugin fails to validate or sanitize input content before substitution occurs. Attacker-controlled content can contain sequences that match these internal placeholder tokens, causing collisions during the substitution phase.

When a collision occurs, the substitution engine may replace, misinterpret, or corrupt content that was not intended for processing. This behavior undermines the integrity of the generated documentation output. The vulnerability requires no privileges and can be triggered whenever the plugin processes attacker-supplied Markdown, such as in shared documentation repositories or continuous integration workflows that ingest external content.

Root Cause

The root cause is improper input validation, tracked under [CWE-20]. The plugin uses a substitution mechanism with predictable placeholder tokens but does not neutralize or escape input that contains those same tokens. This design allows external input to reach the substitution stage without prior sanitization. Details are documented in the GitHub Issue Discussion and the fix appears in the GitHub Commit Details.

Attack Vector

An attacker submits Markdown content containing sequences that match the plugin's internal substitution placeholders. When the plugin processes the file during a documentation build, the placeholder collision produces altered output. Exploitation is network-reachable when documentation is built from public repositories, pull requests, or externally sourced Markdown fragments. See the GitHub Security Advisory for the maintainer's description.

No verified public proof-of-concept code is available. The vulnerability mechanism is described in prose here; refer to the linked advisory and pull request for technical specifics.

Detection Methods for CVE-2025-59940

Indicators of Compromise

  • Documentation builds producing altered or corrupted output that does not match the source Markdown content
  • Unexpected substitution artifacts in rendered pages, such as missing sections or misplaced included content
  • Build logs showing warnings from mkdocs-include-markdown-plugin when processing externally sourced Markdown

Detection Strategies

  • Inventory Python dependencies across documentation pipelines and flag installations of mkdocs-include-markdown-plugin at version 7.1.7 or lower
  • Review pull requests that modify Markdown files for suspicious character sequences resembling plugin placeholder tokens
  • Compare rendered documentation output against source Markdown to identify unexplained substitutions

Monitoring Recommendations

  • Enable software composition analysis on documentation build environments to detect vulnerable plugin versions
  • Log plugin version metadata in continuous integration output for each documentation build
  • Alert on Markdown content ingested from untrusted sources prior to plugin processing

How to Mitigate CVE-2025-59940

Immediate Actions Required

  • Upgrade mkdocs-include-markdown-plugin to version 7.1.8 or later in all documentation projects
  • Audit requirements.txt, pyproject.toml, and lock files across repositories for pinned vulnerable versions
  • Rebuild and republish documentation sites after upgrading to remove any previously corrupted output

Patch Information

The maintainer released version 7.1.8, which fixes the placeholder collision by validating input before substitution. The fix is contained in the GitHub Pull Request and the corresponding GitHub Commit Details. Upgrade using standard Python package management.

Workarounds

  • Restrict documentation builds to trusted Markdown sources until the upgrade is applied
  • Pre-process externally sourced Markdown to strip or escape sequences that match plugin placeholder tokens
  • Isolate documentation build pipelines in restricted environments to limit downstream impact of corrupted output
bash
# Configuration example
pip install --upgrade "mkdocs-include-markdown-plugin>=7.1.8"
pip show mkdocs-include-markdown-plugin | grep Version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.