Description
FastMCP is a Pythonic way to build MCP servers and clients. Prior to version 3.2.0, the OpenAPIProvider in FastMCP exposes internal APIs to MCP clients by parsing OpenAPI specifications. The RequestDirector class is responsible for constructing HTTP requests to the backend service. A vulnerability exists in the _build_url() method. When an OpenAPI operation defines path parameters (e.g., /api/v1/users/{user_id}), the system directly substitutes parameter values into the URL template string without URL-encoding. Subsequently, urllib.parse.urljoin() resolves the final URL. Since urljoin() interprets ../ sequences as directory traversal, an attacker controlling a path parameter can perform path traversal attacks to escape the intended API prefix and access arbitrary backend endpoints. This results in authenticated SSRF, as requests are sent with the authorization headers configured in the MCP provider. This issue has been patched in version 3.2.0.
Problem types
CWE-918: Server-Side Request Forgery (SSRF)
Product status
References
github.com/...astmcp/security/advisories/GHSA-vv7q-7jx5-f767
github.com/...astmcp/security/advisories/GHSA-vv7q-7jx5-f767
github.com/PrefectHQ/fastmcp/pull/3507
github.com/...ommit/40bdfb6b1de0ce30609ee9ba5bb95ecd04a9fb71
github.com/PrefectHQ/fastmcp/releases/tag/v3.2.0