Summary
A Server-Side Request Forgery (SSRF) flaw in Gradio allows attacker-controlled Spaces to inject arbitrary proxy URLs into the victim server's allowlist when loaded with gr.load().
If a victim application loads a malicious Gradio Space, the attacker can abuse the trusted proxy_url configuration to make HTTP requests from the victim's server to internal services, metadata endpoints, and private networks.
Affected context
This vulnerability appears in applications that:
- Integrate Gradio and call
gr.load()to consume external or third-party Gradio Spaces - Trust configuration values (such as
proxy_url) supplied by the remote Space - Permit outbound HTTP(S) requests from the server to internal or external targets
It is most relevant when the Gradio-consuming service has network visibility into internal services, cloud metadata endpoints, or other sensitive HTTP-accessible resources.
Exploit preconditions
- Attack surface: Applications or services that call
gr.load()on attacker-controlled or untrusted Gradio Spaces. - Required access: Ability to publish or control a Gradio Space that the victim will load (e.g., through social engineering, misconfiguration, or integration with arbitrary user content).
- Trigger point: The victim calls
gr.load()on the malicious Space, causing its configuration (includingproxy_url) to be fetched and trusted. - Why exploitation is possible: The
proxy_urlparameter from the remote Space configuration is implicitly trusted and added to the server's allowlist without origin or destination validation, allowing the attacker to redirect the victim server's HTTP client to arbitrary internal endpoints.
Why this happens
The underlying issue is the implicit trust of remotely supplied network configuration data. Gradio's gr.load() mechanism imports configuration from a remote Space, including proxy_url, and then uses that value to extend the server's internal HTTP allowlist.
This maps to CWE-918: Server-Side Request Forgery (SSRF) because untrusted, attacker-controlled input directly influences where the server can send HTTP requests. The server becomes a blind proxy into internal networks, cloud control planes, and other sensitive endpoints, without robust validation of the target URLs or their trustworthiness. The abstract pattern is "remote configuration controls outbound request destinations without constraint."
Potential impact
- Unauthorized access to internal HTTP services (e.g., admin panels, APIs, databases behind gateways).
- Retrieval of cloud provider metadata, potentially exposing access tokens, credentials, or instance details.
- Network reconnaissance of internal IP ranges and services reachable from the victim environment.
- Abuse of the victim's infrastructure as a proxy for further attacks or evasion of IP-based access controls.
- Potential escalation into data exfiltration or further compromise of internal systems, depending on what is reachable via HTTP.
General mitigation guidance
Effective mitigation focuses on treating remote configuration as untrusted and strictly limiting where the server can make outbound requests:
- Introduce robust validation and sanitization for any URL or proxy-like parameter derived from remote Spaces before adding it to an allowlist (e.g., allow only well-known domains or explicit patterns).
- Prefer a default-deny outbound network policy, only permitting HTTP(S) egress to a small set of trusted endpoints required for normal operation.
- Avoid dynamically extending HTTP allowlists based on user- or tenant-controlled configuration; instead, manage outbound destinations centrally through code or infrastructure policy.
- Use network segmentation and firewall rules to prevent application servers from directly reaching sensitive internal services or cloud metadata endpoints whenever possible.
- Apply the principle of least privilege to service roles and credentials exposed to HTTP-accessible systems to limit blast radius if SSRF occurs.
How teams detect issues like this
Detection hinges on recognizing untrusted configuration flows and unusual outbound traffic patterns:
- Static analysis and code review:
- Look for code paths where URL-like parameters (e.g.,
proxy_url,endpoint,callback) are derived from remote or user-controlled configuration and then used in HTTP clients or allowlists. - Flag any logic that dynamically broadens outbound network access based on unverified external metadata.
- Review integration points around
gr.load()to ensure external Spaces are not treated as fully trusted. - Runtime and network monitoring:
- Monitor outbound HTTP requests for connections to internal IP ranges (e.g.,
10.0.0.0/8,169.254.169.254) or unexpected service endpoints. - Use network-level logging and anomaly detection to spot unusual egress targets or patterns associated with specific Spaces.
- Policy enforcement:
- Implement CI/CD checks that forbid use of configuration-driven arbitrary outbound URLs without explicit validation.
- Consider automated security scanning tools that specialize in SSRF pattern detection in code and configuration.

