Intel

AIKIDO-2025-10639

@mastra/mcp-docs-server is vulnerable to Path Traversal

Path Traversal Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.

45

Medium Risk

This Affects:

JS@mastra/mcp-docs-server
0.13.17 - 0.13.20
Fixed in 0.13.21
Are you affected? Scan for Free

TL;DR

Affected versions of this package are vulnerable to Path Traversal due to improper input sanitization in the readMdxContent function. The vulnerability allows attackers to read arbitrary files by manipulating the docPath parameter to escape the intended directory (e.g., using ../../ sequences). This occurs because the joined path (fullPath) is not validated against the base directory before file system access, enabling unauthorized access to sensitive system files. An attacker could exploit this by crafting malicious paths to exfiltrate confidential data outside the docsBaseDir.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range.

Background info

@mastra/mcp-docs-server is vulnerable to Path Traversal in versions 0.13.17 - 0.13.20.

How to fix this

Upgrade the @mastra/mcp-docs-server library to the patch version.