CVE-2023-51449: Gradio makes the `/file` secure against file traversal and server-side request forgery attacks
Gradio before 4.11.0 has a file traversal and an SSRF flaw in its /file route. An unauthenticated attacker can read arbitrary files from a machine that serves a Gradio app on a public URL, if they know the file path. Upgrade to gradio 4.11.0.
Published Dec 21, 2023 · Updated Feb 16, 2024 · Analysis Nov 2, 2026
What an attacker can do
The /file route serves files for Gradio apps. In older versions it did not stop path traversal. A browser normalizes dot segments in a URL, so a normal browser request would not trigger it. A tool such as curl with the --path-as-is flag sends the raw path, and the traversal worked. The same route could also be used for server-side request forgery, making the server fetch URLs for the attacker.
The attacker needs only the app's public URL, as with a demo started with share=True or one hosted on Hugging Face Spaces, and the path of the file they want. No login and no interaction are needed. The CVSS vector scores confidentiality high and integrity and availability low. In practice they can read source code, .env files, keys and model files that the Gradio process can read, and use the SSRF to reach services on the server's internal network.
The EPSS score sits at the 98th percentile, which means this flaw is among the more likely to be exploited. The sources do not report confirmed attacks.
Who is affected
gradio on PyPI below 4.11.0, on any app reachable by untrusted users. The advisory names share=True links and Hugging Face Spaces as typical public exposure.
Check the installed version:
pip show gradiogradio
- Ecosystem
- PyPI
- Affected
- < 4.11.0
- Fixed in
- 4.11.0
- Check
pip show gradio
How to fix it
Upgrade to gradio 4.11.0 or later:
pip install --upgrade "gradio>=4.11.0"Both the traversal and the SSRF are fixed there. One fix commit changes is_in_or_equal in gradio/utils.py, so any relative path containing .. is now rejected, not only one that starts with it. The advisory lists no workaround. Stop public sharing of vulnerable apps until you have upgraded.
How to tell if you were hit
Search access logs for requests to /file= paths that contain ../ sequences or absolute system paths such as /etc/passwd, and for requests with unusual clients such as curl. Look for /file requests that carry full URLs and for outbound connections from the Gradio host to internal addresses. If an affected app was public, assume files readable by its user were exposed and rotate any keys stored on that host.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Older versions of gradio contained a vulnerability in the /file route which made them susceptible to file traversal attacks in which an attacker could access arbitrary files on a machine running a Gradio app with a public URL (e.g. if the demo was created with share=True, or on Hugging Face Spaces) if they knew the path of files to look for.
This was not possible through regular URLs passed into a browser, but it was possible through the use of programmatic tools such as curl with the --pass-as-is flag.
Furthermore, the /file route in Gradio apps also contained a vulnerability that made it possible to use it for SSRF attacks.
Both of these vulnerabilities have been fixed in gradio==4.11.0
Credited to Yaniv-git, nvn1729.
Questions
- Can a normal browser trigger the traversal?
No. The advisory says the traversal did not work through regular URLs in a browser. It worked through programmatic tools such as curl with the path-as-is option.
- Does the attacker need to know file paths?
Yes, for the file read. They must know the path of the file to fetch. Common paths such as .env files, SSH keys and app source are easy to guess.
- Which version fixes CVE-2023-51449?
gradio 4.11.0. Versions below it are affected by both the file traversal and the SSRF.
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 entriesCVE-2026-49119
Gradio FileExplorer preprocess path traversal allows files outside root_dir to reach callbacks
high7.5Jul 1, 2026CVE-2026-10783
Gradio: Audio cache key ignores metadata when saving numpy audio outputs
low2.5Jun 4, 2026CVE-2026-48545
Gradio contains a cookie injection vulnerability
high6.8May 27, 2026CVE-2026-27167
Gradio: Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret
lowMar 1, 2026CVE-2026-28414
Gradio is Vulnerable to Absolute Path Traversal on Windows with Python 3.13+
high7.5Mar 1, 2026CVE-2026-28415
Gradio has an Open Redirect in its OAuth Flow
medium4.3Mar 1, 2026
