@mastra/mcp-docs-server (directory listing / information exposure) | Medium || Field | Value |
|---|---|
| CVE / NVD | CVE-2025-61685 |
| Date (index) | 2025-09-24 |
| Affected product (index) | @mastra/mcp-docs-server (directory listing / information exposure via path traversal logic flaw) |
| GHSA ID | GHSA-xh92-rqrq-227v |
| OWASP MCP Top 10 (2025) | MCP10 — Context Injection & Over-Sharing |
| Published / disclosed | 2025-09-24 |
| Ecosystem | npm |
| Component | @mastra/mcp-docs-server (Mastra Docs MCP Server) |
| EPSS score | 0.005410000 (FIRST EPSS, 2026-07-16) |
| CVSS score | Medium — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N (GHSA; base 6.5) |
| CWE | CWE-548 (Exposure of Information Through Directory Listing) |
| Affected versions | <= 0.13.8 (advisory text also cites 0.13.18 and below) |
| Fixed versions | 0.17.0 |
| Fix status | Patched |
| Exploit status | Public advisory with PoC context (prompt-injection class) |
| Notes | Disclosure credits Liran Tal. Exploitation is commonly chained with prompt injection in AI IDEs that auto-invoke MCP tools. |
@mastra/mcp-docs-server versions up to and including the vulnerable range mishandle path traversal checks in the docs tool. readMdxContent in src/tools/docs.ts rejects traversal attempts, but the execute handler still calls findNearestDirectory with the unsanitized path when content is not found, leaking directory listings outside the intended docs base directory (CWE-548).
Typically requires an MCP client (for example Cursor) configured to run @mastra/mcp-docs-server via npx, plus attacker influence over tool arguments—often through prompt injection that steers the agent to pass traversal paths unchanged.
A control-flow logic flaw: path validation in readMdxContent does not halt downstream suggestion logic, so blocked traversal paths still reach directory-enumeration helpers without equivalent validation.
Documentation MCP servers are treated as low-risk context providers, but this bug exposes filesystem structure (home directory layout, tool folders like .cursor/, cloud credential directories) into model context—useful for targeted follow-on attacks.
src/tools/docs.ts (readMdxContent, execute, findNearestDirectory)// readMdxContent blocks traversal, but execute still runs suggestion helpers when result.found is false
const result = await readMdxContent(path, queryKeywords);
if (result.found) { /* safe return */ }
const directorySuggestions = await findNearestDirectory(path, availablePaths);
Upgrade @mastra/mcp-docs-server to 0.17.0 or later. Until patched, disable the server in MCP client configs or require explicit approval for docs tool calls.
.cursor/mcp.json / equivalent MCP configs.Public advisory documents prompt-injection-driven exploitation; do not host weaponized prompts or traversal payloads in this repository.
npx -y @mastra/mcp-docs-server and confirm package version >= 0.17.0.../ sequences returning directory listings.
https://github.com/mastra-ai/mastra/commit/7f2b528ba82db512d68832d2f8ad6cbc8bb46cd4