AgentbeamBeta
AI agent vulnerability · Gradio

CVE-2024-1727: Gradio applications running locally vulnerable to 3rd party websites accessing routes and uploading files

mediumCVSS 3.1 4.3GHSA-48cq-79qq-6f7x

Gradio before 4.19.2 lets any website a user visits send requests to a Gradio app running on their own machine. A page can upload files to localhost:7860/upload, which fills the disk or plants files. The flaw is cross-site request forgery (CWE-352). Upgrade the gradio pip package to 4.19.2 or later.

Published May 21, 2024 · Analysis Nov 25, 2026

What an attacker can do

A Gradio app started locally listens on a port such as 7860 and did not restrict which web origins could call its routes. A script on any third-party site can therefore make the visitor's browser send requests to localhost:7860. The advisory's example is a page that uploads a large file to the upload route, so the file lands on the machine of anyone who opens the page while a Gradio app is running.

The attacker needs only a web page and a visitor who has a local Gradio app up. The CVSS vector reflects that: network attack, no privileges, user interaction required. It rates the impact as low availability and none for confidentiality and integrity, so the documented harm is unwanted uploads and wasted disk space, not data theft.

Gradio is widely used to demo models on a developer's laptop, so the exposure is mostly on workstations. The maintainers say they have no knowledge of the flaw being used against users.

Who is affected

The gradio package on pip below 4.19.2 is affected. The risk is for apps run locally and reachable on localhost, while the user browses other sites. Check the installed version:

pip show gradio

Any result under 4.19.2 should be upgraded. Apps hosted on Spaces are not the case the advisory describes.

gradio

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

How to fix it

Upgrade to gradio 4.19.2 or higher:

pip install --upgrade "gradio>=4.19.2"

The fix, in pull request 7503, tightens the CORS rules in gradio/route_utils.py. If the request's host header is localhost or an alias, the origin header, when present, must also be localhost or an alias. Otherwise Gradio blocks the request. The advisory lists no workaround, so restart your apps after upgrading.

How to tell if you were hit

Look in the Gradio server output and your uploads folder for files you did not send, especially large ones, and for requests to the upload route that carry an Origin header from an outside site. Check for unexplained drops in free disk space on machines that run Gradio. The advisory gives no log signature. Also check browser history for unfamiliar sites visited while an app ran.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

This CVE covers the ability of 3rd party websites to access routes and upload files to users running Gradio applications locally. For example, the malicious owners of www.dontvisitme.com could put a script on their website that uploads a large file to http://localhost:7860/upload and anyone who visits their website and has a Gradio app will now have that large file uploaded on their computer

Patches

Yes, the problem has been patched in Gradio version 4.19.2 or higher. We have no knowledge of this exploit being used against users of Gradio applications, but we encourage all users to upgrade to Gradio 4.19.2 or higher.

Fixed in: https://github.com/gradio-app/gradio/commit/84802ee6a4806c25287344dce581f9548a99834a CVE: https://nvd.nist.gov/vuln/detail/CVE-2024-1727

Questions

Is Gradio 4.19.2 safe from CVE-2024-1727?

Yes. 4.19.2 is the patched version. It blocks requests whose origin does not match localhost when the host header is localhost. Anything below 4.19.2 is affected.

Does CVE-2024-1727 need me to click something?

You need to open a malicious page while a local Gradio app is running. The CVSS vector sets user interaction to required. The page's script does the rest from your browser.

Is CVE-2024-1727 exploited in the wild?

The maintainers say they have no knowledge of this flaw being used against Gradio users, and it is not in CISA's catalog. The EPSS score in the record is low, at 0.0035.

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