CVE-2026-140424: markdownify-mcp before 1.2.0 Path Allowlist Bypass via isWithinDirectory Prefix Match
markdownify-mcp before 1.2.0 contains a path traversal vulnerability in isWithinDirectory() that allows attackers to bypass MDALLOWEDPATHS and MDSHAREDIR restrictions. Attackers invoking local-file conversion tools directly or via prompt injection can target sibling directories sharing an allowed prefix to read files outside the allowlist.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
markdownify-mcpto a version that resolves this vulnerability.Fixed in 1.2.0
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments of npm/markdownify-mcp before version 1.2.0 are affected when they rely on MD_ALLOWED_PATHS or MD_SHARE_DIR to restrict local-file conversion access. Sibling directories whose names share a prefix with an allowed directory can be targeted.
What access does an attacker need to exploit this?
An attacker needs a way to invoke the local-file conversion tools. This may be through direct tool invocation or through prompt injection that causes the tools to access an attacker-chosen path.
What is the practical impact of a successful bypass?
The bypass can allow reading files outside the configured allowlist or share-directory restriction. The affected restriction is path-based, so files in sibling directories sharing the allowed prefix may be exposed.
How can I determine whether an instance is affected?
Check whether markdownify-mcp is earlier than 1.2.0 and whether MD_ALLOWED_PATHS or MD_SHARE_DIR is configured. Review allowed paths for similarly named sibling directories, since the vulnerable isWithinDirectory() check uses prefix matching.
What should be done if an upgrade cannot be applied immediately?
Restrict who and what can invoke local-file conversion tools, including limiting prompt-injection paths to tool use. Avoid configuring allowed directories alongside sensitive sibling directories with matching path prefixes until version 1.2.0 can be deployed.