NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Gradio

CVE-2024-2206: gradio Server-Side Request Forgery vulnerability

highCVSS 3.0 7.3GHSA-r364-m2j9-mf4h

Gradio before 4.18.0 has an SSRF flaw in its /proxy route. An unauthenticated caller can add arbitrary URLs to the server's list of proxy targets through the X-Direct-Url header, then make the server fetch them. This can reach internal endpoints, such as those inside a Hugging Face Space. Upgrade to gradio 4.18.0.

Published Mar 27, 2024 · Updated Apr 16, 2024 · Analysis Nov 2, 2026

What an attacker can do

Gradio keeps a set called self.replica_urls of hosts it is allowed to proxy. Requests to the / and /config routes can add entries to that set from the X-Direct-Url header. The build_proxy_request function did not check that a URL was safe. An attacker could first register a URL of their choice with one request. They could then call /proxy to make the Gradio server send requests to it.

The attacker needs only network access to the Gradio app. No login and no user interaction are needed. They get a way to send requests from the server's network position, so internal services that are not exposed to the internet may become reachable. The advisory names internal endpoints inside the Hugging Face Space as the example. The CVSS rates the impact as low for confidentiality, integrity and availability, because the proxy forwards requests rather than running code. Impact depends on what internal services sit next to the app, such as metadata services or admin APIs.

Who is affected

gradio on PyPI at versions below 4.18.0. Any app that launches a Gradio server reachable by untrusted users is in scope, including public demos and Hugging Face Spaces.

Check the installed version:

pip show gradio

gradio

Ecosystem
PyPI
Affected
< 4.18.0
Fixed in
4.18.0
Check
pip show gradio

How to fix it

Upgrade to gradio 4.18.0:

pip install --upgrade "gradio>=4.18.0"

Then restart the app. The fix is in the commit linked from the advisory, which also changes how file URLs and the /proxy= paths for external Gradio apps are handled in the backend. The sources I could read give no workaround. Until you upgrade, keep the app off untrusted networks and block its outbound access to internal addresses.

How to tell if you were hit

Check web server or reverse-proxy logs for requests to / or /config that carry an X-Direct-Url header, because normal browsers do not send it. Then look for /proxy requests that follow them. On the app host, look for outbound connections from the Gradio process to internal addresses or to hosts you do not recognise. Confirm the gradio version in every environment, including container images.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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.

Questions

Is gradio 4.18.0 affected by CVE-2024-2206?

No. 4.18.0 is the patched version. Versions below it are vulnerable.

Does the attacker need to log in?

No. The CVSS vector is network, no privileges, no user interaction. The attacker sends requests with an X-Direct-Url header to the / or /config routes and then uses /proxy.

Can this run code on the server?

The advisory describes request proxying and access to internal endpoints, not code execution. The CVSS impact scores are low for confidentiality, integrity and availability.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Gradio vulnerabilities

All Gradio entries