CVE-2026-140424: Markdownify MCP server's MD_ALLOWED_PATHS / MD_SHARE_DIR allowlist could be escaped via sibling folders with the same prefix, symlinks and ~ paths, so agents could read files outside it (fixed 1.2.0)
In mcp-markdownify-server 1.1.0 and earlier, the path allowlist that operators set with MD_ALLOWED_PATHS or MD_SHARE_DIR had three holes. A plain startsWith() check let /srv/share-evil pass for /srv/share, symlinks inside an allowed folder were not resolved, and Markdownify.get() checked the ~-expanded path but read the raw one. A client calling the local-file conversion tools, directly or through prompt injection, could read files outside the allowlist. Fixed in 1.2.0.
What it is
isWithinDirectory() in src/utils.ts used normPath.startsWith(normDir) with no directory-separator boundary, so sibling directories sharing a prefix counted as allowed.
assertPathAllowed() validated the lexical path without fs.realpathSync(), so a symlink inside an allowed directory could point anywhere.
Markdownify.get() validated the expanded resolvedPath but then called fs.existsSync() and readFile() on the unexpanded filePath.
Fixed in v1.2.0 (PR #104) with path.relative() boundary checks, realpath canonicalization of both requested paths and allowed roots, and resolvedPath used for every filesystem call. The advisory GHSA-wp59-q6fv-34rx was published on 25 November 2026; NVD published CVE-2026-140424 on 1 December 2026.
How to check
- Run npm ls mcp-markdownify-server (or check your MCP client config) and confirm the version is 1.2.0 or later.
- If you rely on MD_ALLOWED_PATHS / MD_SHARE_DIR, check for sibling folders with the same prefix and for symlinks inside the allowed folders.
How to fix
- Upgrade mcp-markdownify-server to 1.2.0 or later (this also fixes the SSRF bypass CVE-2026-137308).
- Until then, run it in a container or as a user that can only see the files it should convert.
npm ls mcp-markdownify-server
npm ls -g mcp-markdownify-server