@mastra/mcp-docs-server is vulnerable to Path Traversal
45
Medium Risk
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.
You are affected if you are using a version that falls within the vulnerable range.
@mastra/mcp-docs-server is vulnerable to Path Traversal in versions 0.13.17 - 0.13.20.
Upgrade the @mastra/mcp-docs-server library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

SOC 2Compliant
ISO 27001Compliant