The vulnerability is a Server-Side Request Forgery (SSRF) in the Gradio library, originating from the gr.load() function. The root cause is the improper handling of the proxy_url parameter within a remote Gradio Space's configuration.
The exploit chain begins when a victim's application uses gradio.external.load (commonly aliased as gr.load) to load a malicious, attacker-controlled Gradio Space. The load function fetches the space's configuration and passes it to gradio.blocks.Blocks.from_config. This method insecurely trusts the proxy_url from the remote configuration, adding it to a set of allowed proxy targets without proper validation. An attacker can set this URL to an internal service or a cloud metadata endpoint (e.g., http://169.254.169.254/).
Once the malicious URL is allow-listed, the attacker can trigger the SSRF by making a request to the Gradio application's built-in proxy endpoint, /proxy={url}. This endpoint is handled by the gradio.routes.reverse_proxy function, which in turn uses gradio.routes.App.build_proxy_request to construct and dispatch the server-side request. Because the attacker's malicious URL is now in the trusted proxy_urls set, the application makes a request to the specified internal service, leading to potential cloud credential theft, internal network scanning, or access to sensitive internal services.
The patch applies a defense-in-depth strategy by adding validation in two places: Blocks.from_config is updated to only add proxy_url values that point to a .hf.space host, and App.build_proxy_request is also updated to independently verify that any URL being proxied belongs to a .hf.space host, preventing the proxy from being used to access arbitrary URLs.