-
Notifications
You must be signed in to change notification settings - Fork 503
Description
I've identified a Server-Side Request Forgery (SSRF) vulnerability in the MCP server registration and validation flow.
Description
The validateMcpServer function in packages/core/src/tools.ts (and its caller createProject2 in apps/web/server/api/routers/project.ts) connects to user-provided URLs using MCPClient.create() without any prior safety checks. This allows an attacker to force the Tambo server to make requests to internal network addresses, such as the AWS Metadata Service (169.254.169.254), internal databases, or other private infrastructure.
While a urlSecurity.ts utility exists in apps/web/lib/, it is not applied to MCP server registrations. Furthermore, the existing utility is vulnerable to DNS Rebinding because it performs a separate DNS resolution check before the actual request is made by the client.
Impact
An attacker can probe the internal network where the Tambo API/Web server is hosted, potentially leading to information disclosure or further exploitation of internal services.
Recommendation
- Move the URL validation logic from
apps/web/lib/urlSecurity.tsto a shared package (e.g.,packages/coreor a newpackages/security) so it can be applied consistently across the codebase. - Ensure
validateMcpServerperforms strict URL sanitization and SSRF checks before initiating any connections. - Harden the SSRF protection to mitigate DNS Rebinding, for example by resolving the hostname once and using the resulting IP address for the connection (while maintaining the Host header) or by using a dedicated egress proxy.