Medium severity6.5NVD Advisory· Published May 29, 2025· Updated Apr 29, 2026
CVE-2025-5273
CVE-2025-5273
Description
All versions of the package mcp-markdownify-server are vulnerable to Files or Directories Accessible to External Parties via the get-markdown-file tool. An attacker can craft a prompt that, once accessed by the MCP host, will allow it to read arbitrary files from the host running the server.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
mcp-markdownify-servernpm | <= 0.0.1 | — |
Patches
13a6b202d088eMerge pull request #16 from supriza/add-get-file-validation
2 files changed · +28 −1
README.md+3 −1 modified@@ -76,7 +76,9 @@ To integrate this server with a desktop app, add the following to your app's ser - `docx-to-markdown`: Convert DOCX files to Markdown - `xlsx-to-markdown`: Convert XLSX files to Markdown - `pptx-to-markdown`: Convert PPTX files to Markdown -- `get-markdown-file`: Retrieve an existing Markdown file +- `get-markdown-file`: Retrieve an existing Markdown file. File extension must end with: *.md, *.markdown. + + OPTIONAL: set `MD_SHARE_DIR` env var to restrict the directory from which files can be retrieved, e.g. `MD_SHARE_DIR=[SOME_PATH] pnpm run start` ## Contributing
src/Markdownify.ts+25 −0 modified@@ -48,6 +48,17 @@ export class Markdownify { return tempOutputPath; } + private static normalizePath(p: string): string { + return path.normalize(p); + } + + private static expandHome(filepath: string): string { + if (filepath.startsWith('~/') || filepath === '~') { + return path.join(os.homedir(), filepath.slice(1)); + } + return filepath; + } + static async toMarkdown({ filePath, url, @@ -96,6 +107,20 @@ export class Markdownify { }: { filePath: string; }): Promise<MarkdownResult> { + // Check file type is *.md or *.markdown + const normPath = this.normalizePath(path.resolve(this.expandHome(filePath))); + const markdownExt = [".md", ".markdown"]; + if (!markdownExt.includes(path.extname(normPath))){ + throw new Error("Required file is not a Markdown file."); + } + + if (process.env?.MD_SHARE_DIR) { + const allowedShareDir = this.normalizePath(path.resolve(this.expandHome(process.env.MD_SHARE_DIR))); + if (!normPath.startsWith(allowedShareDir)) { + throw new Error(`Only files in ${allowedShareDir} are allowed.`); + } + } + if (!fs.existsSync(filePath)) { throw new Error("File does not exist"); }
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-22v8-p7h2-rj7pghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-5273ghsaADVISORY
- github.com/zcaceres/markdownify-mcp/blob/3667bd4765c0e49684ce22df268d02dd478a7f3b/src/Markdownify.tsghsaWEB
- github.com/zcaceres/markdownify-mcp/commit/3a6b202d088ef7acb8be84bc09515f41a2b1a9dfnvdWEB
- security.snyk.io/vuln/SNYK-JS-MCPMARKDOWNIFYSERVER-10249193nvdWEB
- github.com/zcaceres/markdownify-mcp/blob/3667bd4765c0e49684ce22df268d02dd478a7f3b/src/Markdownify.ts%23L94nvd
News mentions
0No linked articles in our index yet.