Summary
A server-side request forgery (SSRF) vulnerability in the gpt-researcher project (up to version 3.4.3) allows attackers to influence how the server fetches external resources via the source_urls argument on a WebSocket endpoint.
By supplying crafted URLs, a remote attacker may coerce the server into making arbitrary outbound requests, potentially reaching internal services or cloud metadata endpoints that are not directly accessible from the internet.
Affected context
This vulnerability occurs in deployments of gpt-researcher that:
- Expose the WebSocket (ws) endpoint over a network interface reachable by attackers
- Accept user-controlled
source_urlsparameters to retrieve or process external content - Allow the server process to initiate outbound HTTP/HTTPS (or other protocol) requests without strict egress restrictions
The issue is more severe in environments where the server can reach internal services, management interfaces, or cloud metadata endpoints that should not be accessed based solely on user-provided URLs.
Exploit preconditions
- Attack surface: Network-accessible WebSocket endpoint in gpt-researcher that processes the
source_urlsargument. - Required access: Ability to initiate a WebSocket connection to the vulnerable endpoint (typically unauthenticated or low-barrier access in many deployments).
- Trigger point: Submission of crafted
source_urlsvalues that reference internal IP ranges, hostnames, or sensitive HTTP endpoints. - Why exploitation is possible: The server trusts the
source_urlsinput and uses it directly (or with insufficient validation) to perform outbound requests, effectively allowing user-controlled targets for server-side HTTP calls.
Why this happens
The underlying bug class maps to CWE-918: Server-Side Request Forgery (SSRF).
The application exposes functionality that fetches or processes remote resources based on user-provided URLs via the source_urls parameter on a WebSocket endpoint.
Instead of treating these URLs as untrusted input and constraining where the server may connect, the code appears to forward them to an HTTP client or equivalent networking API with minimal or no validation.
This design pattern—allowing untrusted input to control server-initiated network requests—creates a channel for attackers to pivot the server into acting as a proxy to internal networks or privileged endpoints.
Potential impact
- May allow attackers to reach internal HTTP services that are not exposed to the public internet.
- Could enable interaction with cloud provider metadata services, potentially leading to credential exposure.
- Can be used to perform port scanning or service enumeration of internal network segments from the server's vantage point.
- May facilitate bypassing IP-based access control lists by routing traffic through the trusted server.
- Could support further attack chains, including data exfiltration or lateral movement, if sensitive internal APIs are accessible.
General mitigation guidance
Effective mitigation focuses on restricting where and how the server can connect when user input controls URL-based requests:
- Introduce allowlists for outbound destinations (e.g., only approved domains or hosts may be fetched) and reject all others by default.
- Implement URL validation and normalization to prevent access to internal IP ranges, localhost, link-local addresses, or non-HTTP schemes.
- Use network-level egress controls (firewall rules, VPC security groups) to block unnecessary outbound traffic, particularly to internal subnets and metadata endpoints.
- Treat any user-specified URL as untrusted and consider routing outbound requests through a restricted proxy that enforces domain and path policies.
- Apply the principle of least privilege to the server's network permissions and service account capabilities so that even if SSRF is attempted, the reachable surface is minimized.
How teams detect issues like this
High-level detection and review approaches typically include:
- Static analysis and code review to identify code paths where user-controlled parameters (like
source_urls) are passed into HTTP clients or URL fetchers without robust validation. - Use of custom linting rules or security scanners that flag dynamic URL construction, direct use of user input in network APIs, or lack of destination allowlisting.
- Configuration and infrastructure reviews to ensure that application servers do not have unnecessary network reachability, especially to internal services or metadata endpoints.
- Runtime monitoring and logging of outbound requests, with anomaly detection for unusual destinations (e.g., RFC1918 address space, localhost, or cloud metadata IPs) initiated by application components.

