Summary
A Server-Side Request Forgery (SSRF) flaw in FastGPT's dataset preview endpoint lets an authenticated user bypass internal network protections and force the server to send HTTP GET requests to arbitrary internal services.
The issue is triggered when using the externalFile data import type with /api/core/dataset/file/getPreviewChunks, enabling indirect access to network resources that should not be reachable from the application layer.
Affected context
This vulnerability occurs in FastGPT deployments that:
- Expose the
/api/core/dataset/file/getPreviewChunksendpoint - Allow authenticated users to import data via the
externalFiledata import type - Rely on a global
isInternalAddresscheck to block internal network access
In this context, the dataset preview feature performs server-side HTTP GET requests to user-influenced URLs.
Due to an incomplete prior fix, some requests triggered during preview escape the intended internal-address filtering.
Exploit preconditions
- Attack surface: HTTP API endpoint
/api/core/dataset/file/getPreviewChunks - Required access: Valid authenticated user account with permission to import or preview external files as dataset sources
- User-controlled input: URL or location parameters associated with the
externalFiledata import type - Trigger point: Invoking dataset file preview, which causes the server to fetch content by issuing HTTP GET requests
- Why exploitation is possible: The internal network protection (
isInternalAddress) is not consistently applied or is bypassable for preview requests, allowing attacker-controlled URLs to target internal hosts (e.g.,127.0.0.1, metadata services, or internal service endpoints).
Why this happens
The root cause is a classic Server-Side Request Forgery pattern mapped to CWE-918, where a backend feature fetches remote resources based on user-influenced URLs without robust validation.
In this scenario, the dataset preview logic for externalFile sources issues HTTP GET requests using parameters that can be controlled by an authenticated user.
The global isInternalAddress protection is incompletely or inconsistently enforced in the code path used by /api/core/dataset/file/getPreviewChunks, leaving a gap that attackers can exploit to route requests to internal addresses.
Conceptually, the insecure pattern is:
- Trusting user-provided URLs as fetch targets
- Performing those requests from a privileged internal network position
- Relying on a single, brittle internal-address filter that does not fully cover all use cases or canonicalization edge cases.
Potential impact
- Unauthorized interaction with internal HTTP services that are not directly exposed to the internet
- Discovery of internal network structure and reachable endpoints through response behavior
- Potential access to sensitive metadata services (e.g., cloud instance metadata) if reachable via HTTP
- Abuse of internal APIs that rely on network location for trust, possibly leading to data exposure or configuration manipulation
- Use of the server as a pivot point for further attacks within the internal network, depending on accessible services
General mitigation guidance
Effective mitigation generally focuses on removing or sharply constraining server-side URL fetches and hardening network trust boundaries, including:
- Treat all user-supplied URLs as untrusted input and subject them to strict allowlisting (e.g., only specific domains or storage providers for external files).
- Implement URL validation that accounts for redirects, DNS rebinding, IPv4/IPv6 formats, and special hostnames to robustly exclude internal and link-local ranges.
- Introduce a separate, restricted HTTP client or egress configuration for all user-driven fetches, with outbound rules that block private and management networks.
- Decouple sensitive internal service access from general-purpose HTTP clients; never reuse privileged HTTP clients for user-controlled URL fetching.
- Apply defense in depth with network-level controls (firewalls, service meshes, egress proxies) so that application-layer mistakes do not directly expose internal services.
- Design preview/import workflows so that, where possible, clients upload data rather than instructing the server to fetch from arbitrary locations.
How teams detect issues like this
SSRF risks can often be surfaced and monitored through a combination of code-level and operational checks:
- Static analysis: Flag any code paths that:
- Accept user-controlled URLs or hostnames
- Use generic HTTP clients (
GET,fetch,axios, etc.) without a clearly enforced allowlist or SSRF guard
Rules can specifically look for pairing of request-creation APIs with request parameters derived from HTTP request bodies, query strings, or user configuration.
- Code review signals: During review, carefully scrutinize:
- New or modified endpoints that fetch remote content (e.g., dataset import/preview, webhooks, integrations)
- Reliance on simple
isInternalAddresschecks instead of centralized URL validation utilities - Assumptions that "authenticated users" are inherently trusted in network terms
- Policy enforcement: Introduce architectural guidelines such as:
- "All external URL fetching must go through a dedicated SSRF-safe client" with preconfigured restrictions
- "No direct use of raw HTTP clients with user-influenced URLs"
Automated policy checks in CI/CD can block merges that violate these patterns.
- Runtime monitoring: At the infrastructure level, monitor outbound HTTP traffic from application pods/instances and alert on:
- Connections to internal IP ranges from endpoints expected to talk only to the internet
- Unexpected access attempts to metadata or management endpoints.

