gradio Server-Side Request Forgery vulnerability
The gradio application's /proxy route fails to properly validate user-supplied URLs, and an attacker can add arbitrary URLs to the allowed proxy list via the X-Direct-Url header. This allows the attacker to proxy requests to internal endpoints within the Hugging Face space.
gradio-app/gradio
Originally disclosed on huntr
An SSRF vulnerability exists in the gradio-app/gradio due to insufficient validation of user-supplied URLs in the /proxy route. Attackers can exploit this vulnerability by manipulating the self.replica_urls set through the X-Direct-Url header in requests to the / and /config routes, allowing the addition of arbitrary URLs for proxying. This flaw enables unauthorized proxying of requests and potential access to internal endpoints within the Hugging Face space. The issue arises from the application's inadequate checking of safe URLs in the build_proxy_request function.
From the GitHub Advisory Database (GHSA-r364-m2j9-mf4h, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the build_proxy_request function does not adequately validate that URLs added via the X-Direct-Url header are safe before using them for proxying.
Impact
An attacker could proxy requests to internal endpoints within the Hugging Face space, potentially accessing sensitive internal services.
What the attacker needed
Access to the gradio app; ability to send requests with custom headers
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Server-Side Request Forgery (SSRF) is when an attacker makes a server send requests to places the attacker cannot reach directly, like internal services. Here, the gradio app lets users add URLs to a proxy list without proper checks, so an attacker can trick the server into fetching internal resources.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.