Summary
FastGPT's MCP (Model Context Protocol) tools endpoints accept user-controlled URLs and perform server-side HTTP requests without checking whether those URLs target internal or private network addresses.
Under these conditions, an authenticated attacker can abuse the vulnerable endpoints to scan internal networks, query cloud metadata services, and interact with internal infrastructure that is not directly exposed to the internet.
Affected context
This vulnerability appears in FastGPT deployments that:
- Expose the MCP tools endpoints:
POST /api/core/app/mcpTools/getToolsPOST /api/core/app/mcpTools/runTool- Allow authenticated users to supply arbitrary URLs to these endpoints
- Run FastGPT inside an environment where the server has network access to internal services (e.g., MongoDB, Redis, internal APIs, cloud metadata endpoints)
The issue is that these endpoints do not invoke the existing isInternalAddress() SSRF protection function, leaving internal address filtering inconsistent across the application.
Exploit preconditions
- Attack surface: HTTP(S) access to the FastGPT MCP tools API endpoints.
- Required access: Valid authenticated FastGPT user account capable of invoking MCP tools (no special OS-level privileges assumed).
- Trigger point: Submission of a crafted request to
/api/core/app/mcpTools/getToolsor/api/core/app/mcpTools/runToolwith a URL parameter pointing to an internal or sensitive network location. - Why exploitation is possible: The endpoints directly use the attacker-supplied URL for server-side HTTP requests without applying the existing
isInternalAddress()checks, allowing requests to arbitrary reachable hosts from the server's network perspective.
Why this happens
The underlying bug is an inconsistent application of SSRF defenses.
While FastGPT includes a dedicated isInternalAddress() function to prevent server-side requests to internal IP ranges and metadata services, the MCP tools endpoints bypass this control and trust user-supplied URLs.
This matches CWE-918: Server-Side Request Forgery (SSRF), where an application allows attackers to induce server-side network requests to arbitrary destinations, using the server as a proxy to reach otherwise protected resources.
Potential impact
- Attackers may scan internal IP ranges and port configurations to map the internal network.
- Attackers may access cloud metadata services, potentially obtaining credentials or instance configuration.
- Attackers may interact with internal databases (e.g., MongoDB) and caches (e.g., Redis), which can lead to data exposure or data modification depending on service configuration.
- Attackers may reach internal HTTP-based admin panels, debugging endpoints, or service control APIs not intended to be internet-facing.
- Attackers may chain SSRF with other weaknesses (e.g., insufficient authentication on internal services) to escalate to code execution or broader infrastructure compromise.
General mitigation guidance
Mitigation generally focuses on enforcing strict network egress controls from application code and environment:
- Apply a consistent SSRF protection layer for all features that issue server-side HTTP requests, including MCP tools, by centralizing URL validation and ensuring it is invoked on every outbound request.
- Implement strict allowlists for outbound destinations or URL patterns, favoring known-good hosts over broad denylists of private and metadata address ranges.
- Normalize and parse URLs carefully before validation, and re-check after any redirects to prevent bypasses.
- Restrict the application server's network reach using infrastructure controls (e.g., firewall rules, security groups, egress policies) so that sensitive internal services and metadata endpoints are not directly accessible.
- Separate internal management services and data stores onto network segments that are not reachable from application frontends, or require strong authentication even from internal callers.
How teams detect issues like this
Possible detection and monitoring strategies include:
- Static analysis rules or code scanning policies that flag HTTP client calls using user-controlled URLs which do not pass through a common validation or SSRF-protection function.
- Code review checklists that require reviewers to verify use of shared helpers like
isInternalAddress()for any new feature performing outbound HTTP requests. - Runtime monitoring of outbound traffic from the application, with alerts on requests to internal IP ranges, cloud metadata endpoints, or unexpected ports and protocols.
- Web application firewall (WAF) or API gateway rules that restrict or log suspicious URL parameters associated with proxying or fetching remote resources.
- Periodic internal penetration testing or dynamic analysis focused on "URL fetch" or "webhook" style features to discover SSRF-like behaviors.

