AAK-MCP-015: Path traversal in MCP resource or tool file handler
- Severity
- CRITICAL
- Category
- MCP Configuration (
mcp-config) - Scanner
agent_audit_kit/scanners/mcp_auth_patterns.py- Auto-fixable
- No.
- SARIF name
McpPathTraversal
What it detects
An MCP server exposes a resource/file handler that passes user-supplied paths to open()/fs.readFile without normalization or allowlist checks. 2,614 MCP implementations surveyed; 82% had this class of issue. In a TypeScript tool handler it also follows a destructured tool argument through path.join / path.resolve to an fs read or write with no containment check in between, the shape of CVE-2026-94044.
How to fix
Resolve the requested path, reject '..' components, and verify the final path is under an explicit root directory.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-015
Limitations
Regex and proximity, not data flow. The TypeScript arm follows one path.join / path.resolve from a destructured tool argument to an fs read or write within one handler-sized window, so a path assembled through helper functions is missed. It stays silent on a containment check it recognises (startsWith, path.relative, realpath) and on any if naming the joined path that throws or returns, by design, so a weak check can silence it; path.basename() around the argument counts as sanitizing.
References
- CVE: CVE-2026-50158, CVE-2026-77248, CVE-2026-94044
- OWASP MCP Top 10: MCP05:2025 (Command Injection & Execution)
- OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-RES-01
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-015.md: the page then shows that text, with the registry reference appended under it.